Problem 4A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.
Find the largest palindrome made from the product of two 3-digit numbers.
maxPalindrome = 0
For i = 990 To 100 Step -11 ' Palindromes are always multiples of 11
For j = 999 To 100 Step -1
product = i * j
CheckPalindrome()
If isPalindrome = "True" Then
TextWindow.WriteLine("Considered " + product + "...")
If product > maxPalindrome Then
maxPalindrome = product
Goto EndInnerLoop
EndIf
EndIf
EndFor
EndInnerLoop:
EndFor
TextWindow.WriteLine("Maximum Palindrome = " + maxPalindrome)
Sub CheckPalindrome
isPalindrome = "False"
productReverse = ""
length = Text.GetLength(product)
For k = 0 To length - 1
subText = Text.GetSubText(product, k, 1)
productReverse = Text.Append(subText, productReverse)
EndFor
If productReverse = product Then
isPalindrome = "True"
EndIf
EndSub