Options: Save as PDF | Save attached file | Toggle line numbers
| Type: |
sub |
| Added By: |
Rembo |
| Short Description: |
|
| Notes: |
The problem description is included with the code. |
| Added: |
May 25 2009 at 11:01 AM |
| Related URLs |
http://projecteuler.net
|
Run the routine, the answer is printed in the debugging screen.
Sub Euler_0004()
'A 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.
Dim i As Long, i2 As Long
Dim lPalindrome As Long
-
'Assume that palindrome is a 6 digit number
'(could be 5 digits but for now ignore that option)
lPalindrome = 0
For i = 999 To 316 Step -1
For i2 = i To 316 Step -1
If bPalindrome(i * i2) Then
If i * i2 > lPalindrome Then
lPalindrome = i * i2
End If
End If
Next i2
Next i
Debug.Print lPalindrome
End Sub