All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
A palindrome product (Posted on 2012-09-05) Difficulty: 3 of 5
Find the largest palindrome which is a product of two 3-digit numbers.

See The Solution Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 4 |

CLS
FOR a = 100 TO 999
FOR b = a TO 999
  prod = a * b
  p$ = LTRIM$(STR$(prod))
  pal = 1
  FOR i = 1 TO LEN(p$) / 2
    IF MID$(p$, i, 1) <> MID$(p$, LEN(p$) + 1 - i, 1) THEN pal = 0: EXIT FOR
  NEXT
  IF pal THEN
    IF ct = 0 THEN PRINT a, b, prod
    ct = ct + 1
    IF prod >= prodmax THEN
     asav = a: bsav = b: psav = prod
     prodmax = prod
    END IF
  END IF
NEXT
NEXT
PRINT asav, bsav, psav
PRINT ct

PRINT

FOR a = 100 TO 999
FOR b = 100 TO 999
  prod = a * b
  p$ = LTRIM$(STR$(prod))
  pal = 1
  FOR i = 1 TO LEN(p$) / 2
    IF MID$(p$, i, 1) <> MID$(p$, LEN(p$) + 1 - i, 1) THEN pal = 0: EXIT FOR
  NEXT
  IF pal THEN
    IF prod = prodmax THEN
     PRINT a, b, prod
    END IF
  END IF
NEXT
NEXT

101           101           10201
913           993           906609
1239

913           993           906609
993           913           906609

indicating the lowest is 101*101=10201 and the highest product is 913*993=906609 and there are 1239 products of two 3-digit integers with palindromic products, not counting reversals. The only way to achieve 906609 by multiplying 3-digit numbers is by 913*993 as 906609=3*11*83*331.


  Posted by Charlie on 2012-09-05 12:58:56
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information