Palindromes

Stump your fellow simians.
Sentzeu
Posts: 102
Joined: Sat Aug 21, 2004 12:16 am

Palindromes

Post by Sentzeu » Thu Aug 26, 2004 6:18 pm

Hi to you all, this is my first post. Here's the first math puzzle that I've ever submitted.


Can any palindrom with an 2n number of digits be divided by 11?

Examples

1221/11=111

137731/11=12521

82344328/11=7485848

935482284539/11=85043844049

User avatar
Brown
Posts: 297
Joined: Wed Jun 09, 2004 3:15 pm

Post by Brown » Thu Aug 26, 2004 6:54 pm

Answer: Yes.

A test for divisibility by 11 is to add up the two sets of alternate digits in a number and see if they are identical or if they differ from each other by a factor of 11. If they do, the whole number is divisible by 11. For example, in determining whether 12,345,674 is divisible by 11, add 1+3+5+7 (the first, third, fifth and seventh digits) and compare to 2+4+6+4 (the second, fourth, sixth and eighth digits). In this case, both sums are identical, so 12,345,674 is divisible by 11.

In the case of a palindromic number having an even number of digits, the sums of alternate digits will always be the same.

User avatar
Beleth
Posts: 2867
Joined: Tue Jun 08, 2004 8:55 pm
Location: That Good Night
Has thanked: 9 times
Been thanked: 6 times

Post by Beleth » Thu Aug 26, 2004 7:01 pm

Yes.

Bah, Brown beat me to it.

Sentzeu
Posts: 102
Joined: Sat Aug 21, 2004 12:16 am

Post by Sentzeu » Thu Aug 26, 2004 7:42 pm

I encountered this problem in a programming competetion.

We had to write a program that would find all palindromic primes up to 1000000. The first step we devised was to first generate a list of palindromes and then I suddenly realised that we only needed those with an odd number of digits. Counting off those who began with an even digit or 5 and we only needed to check 360 candidates.

Then after devising a quick prime checker we had ourselves a rather fast palindromic prime generator.

By the way the program had to be run on a 44Mhz processor platform within a certain timelimit and the language we made the program in was C, of course.