Showing posts with label Project Euler. Show all posts
Showing posts with label Project Euler. Show all posts

Monday, 9 August 2010

Even-length palindromic numbers mod 11 = 0

I was surprised to learn from a comment on Project Euler that palindromic numbers are always divisible by 11.

Here's the proof (for six digit numbers):
i.) A palindromic number has the form abccba [By definition]
ii.) abccba = 100000a + 10000b +  1000c + 100c + 10b + a [Expansion in Base 10]
iii.) abccba = (100000a + a) + (10000b + 10b) + (1000c + 100c) [Re-organizing ii.)]
iv.) abccba = 100001a + 10010b + 1100c [Re-organizing iii.)]
v.) abccba = 11 (9091a + 910b + 100c) [Factor out 11 from iv.)]
QED [= Proved, since we have factored 11 out.]


I think this always holds for palindromes (of any length) with an even number of characters, but it does not necessarily hold if you are allowed to include an 'odd' digit in the centre. (I know it sometimes holds because 121 = 11 x 11, but I don't know if 121 is a special case.)
Enhanced by Zemanta

Thursday, 15 July 2010

Project Euler

By 1772, Leonhard Euler had proved that 2,147,...Image via Wikipedia
"Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems."

(Leonard Euler, pictured at left, was a Swiss 18th Century mathematician.)
Enhanced by Zemanta