' https://projecteuler.net/problem=4
sub main()
max = 0
for i = 999 to 100 step -1
for j = 999 to 100 step -1
n = i*j
if palindromic(n) and n > max
max = n
end if
end for
end for
print max
end sub
function palindromic(n) as boolean
n$ = n.toStr()
' Any single digit number is a palindrome.
if n$.len() = 1 return true
isPalindrome = true
' Two digits or more
' Compare
for i = 0 to int( n$.len() / 2 )
if n$.mid(i,1) <> n$.mid(n$.len()-1-i,1)
isPalindrome = false
exit for
end if
end for
return isPalindrome
end function
Comments
Join the discussionNo comments yet. Be the first to comment.
BrightScript
BrightAuthor plugin development with BrightScript, the scripting programming language for the BrightSign player.