Massive Even Length Palindromes

What is the 3,141,592,653th positive even length palindromic integer in base 10?

A palindrome is a number which reads the same when written forward and backwards. The first 3 even length palindromes are 11, 22, and 33.

Source: https://codeforces.com/problemset/problem/688/B


The answer is 31415926533562951413.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Alex Li
Mar 12, 2020

We can notice a pattern if we look at the first few palindromes which gives intuition for the answer immediately: (quotes ' added for emphasis, they mean nothing) 1 1 , 2 2 , 3 3 , 4 4 , 5 5 , 6 6 , 7 7 , 8 8 , 9 9 , 1 0 01 , 1 1 11 , 1 2 21 , 1 3 31 , 1 4 41 , . . . 1'1, 2'2, 3'3, 4'4, 5'5, 6'6, 7'7, 8'8, 9'9, 10'01, 11'11, 12'21, 13'31, 14'41, ...

Hypothesis: the k th k^{\text{th}} even length palindrome is the number k written forwards concatenated with it written backwards. Call this map (which takes an integer and returns the first even length palindrome starting with that integer) ϕ \phi , it is injective since it sends no two elements to the same place.

To prove this, note that any even length palindrome is a number written forwards concatenated with itself written backwards, by definition of a palindrome, so ϕ \phi is surjective. As it's also injective, ϕ \phi is a bijection. Notice that for any two natural numbers a and b, ϕ ( a ) > ϕ ( b ) \phi(a) > \phi(b) if and only if a is larger than b. Thus the map ϕ \phi also preserves order, and is a isomorphism, and so the k th k^{\text{th}} palindrome is given by ϕ ( k ) \phi(k) .

In particular, ϕ ( 3 , 141 , 592 , 653 ) = 314159265 3 3562951413. \phi(3,141,592,653) = 3141592653'3562951413.

I was making a mistaking :) Thanks for the solution!

Alexander Shannon - 1 year, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...