Why Might My Palindrome Calculation Be Incorrect?

  • Thread starter rwinston
  • Start date
In summary, the conversation discusses a problem on ProjectEuler.net where the goal is to find the largest palindrome constructed from the product of two three-digit integers. The answer is 906609, but one person found a different answer and is questioning their logic. They started at the upper bound of 999^2 and counted down, but realized their flaw in assuming that all products in this range would be three-digit integers. They later found that their answer, 997799, is not the product of two three-digit integers.
  • #1
rwinston
36
0
Hi all

I was looking q # 4 on ProjectEuler.net, and it is a problem to find the largest palindrome constructed from the product of two three-digit integers.

Now, the answer (spoilers, if you don't want to know ) is 906609. However, I got a different answer, but possibly my logic is incorrect. Can anyone spot a flaw in the following reasoning:

As the upper bound of 2 3-digit numbers, I chose 999^2 = 998001. Hence, by counting down from this to a lower limit (say 100) I should have all of the 3-digit integer products in this range? Thus, by starting at the upper limit and counting down, and then testing each integer at every step for the palindrome property, I should find the largest.

I found a palindrome, 997799 which is > the given answer and < 999^2. However, I can't see the flaw in my logic which would imply that this is incorrect and the given answer is correct. Can anyone point me in the right direction? Thanks!

Edit: ok, I think I may have seen the flaw...I guess starting at N^2 and working down is not correct as, I can't guarantee that the factorization at each step is two three-digit integers.
 
Last edited:
Physics news on Phys.org
  • #2
You found it. 997799 = 11 x 90709 is not the product of two three-digit integers.
 

FAQ: Why Might My Palindrome Calculation Be Incorrect?

What is a palindromic number?

A palindromic number is a number that reads the same backward as forward. For example, 121 is a palindromic number since it remains the same when read from left to right or right to left.

What is the largest palindromic number?

The largest palindromic number is 99999999999999999999, which has 20 digits and is known as the largest palindromic number with an even number of digits.

Are all palindromic numbers the same?

No, not all palindromic numbers are the same. They can vary in length and can be made up of different digits. For example, 121 is a palindromic number, but 12321 is a different palindromic number.

How can I check if a number is palindromic?

To check if a number is palindromic, you can simply reverse the number and compare it to the original number. If they are the same, then the number is palindromic. Another way is to convert the number into a string and then check if the string is the same when reversed.

Are palindromic numbers useful in science?

Yes, palindromic numbers have applications in various areas of science such as genetics, cryptography, and mathematics. In genetics, palindromic sequences play a role in DNA replication and gene regulation. In cryptography, palindromic numbers can be used for encryption and decryption purposes. In mathematics, there are several conjectures and theorems related to palindromic numbers, making them a subject of interest for mathematicians.

Similar threads

Replies
1
Views
1K
Replies
3
Views
1K
Replies
5
Views
3K
Replies
3
Views
2K
Replies
13
Views
2K
Replies
6
Views
2K
Replies
3
Views
3K
Back
Top