For positive integer , define as an -digit positive integer such that in decimal representation, the last (rightmost) digits of is itself. Denote as the sum of all possible values of . Find the 14th smallest integer that doesn't satisfy the equation .
Details and Assumptions :
As an explicit example: If , then because and and then but if , only, so .
I don't consider as the smallest integer that doesn't satisfy the equation .
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.
There are two infinite sequences of numbers { a n } and { b n } where a k 2 ≡ a k (mod 1 0 k ) and b k 2 ≡ b k (mod 1 0 k ). For every value of n ≥ 1 , the satisfy the following equation:
k = 1 ∑ n 1 0 k − 1 ( a k + b k ) = 1 0 k + 1
By analyzing this equation we see that a k + b k = 9 for n > 1 . If a k or b k equal 0 , then M n will only have one solution, and therefore will not satisfy they equation L k = 1 0 k + 1 . We need to find an algorithm that will find count the number of times that a k or b k equals 0 . There is a fairly simple method to find subsequent values of a k where a 1 = 5 . Using a k + b k = 9 , we must now count when a k ∈ { 0 , 9 } .
We define A n as the following, relate it to our sequence a n , and use the following equations and congruences to build our algorithm.
A n = k = 1 ∑ n a k 1 0 k − 1
( A n 2 − A n ) 1 0 − k ≡ a n + 1 (mod 1 0 )
A n + 1 = a n + 1 1 0 n + A n
Using these formulas I was able determine each value of k such that a k ∈ { 0 , 9 } . Here's an example of how it works:
a 1 = 5 , a 2 = 2 , A 2 = 5 ( 1 0 0 ) + 2 ( 1 0 1 ) = 2 5
1 0 2 2 5 2 − 2 5 = 6 ≡ 6 (mod 1 0 ) ⟹ a 3 = 6
A 3 = 6 ( 1 0 2 ) + 2 5 = 6 2 5
Save the value of A n and check values of a n + 1 at every iteration.
Here is the list I came up with using this algorithm:
4 , 5 , 1 2 , 1 3 , 2 0 , 2 4 , 2 5 , 2 9 , 3 2 , 3 3 , 3 4 , 3 5 , 3 8 , 4 0
Notice that k = 1 is also a non-solution as M n = 1 , 5 , 6 ⟹ L k = 1 + 5 + 6 = 1 2 > 1 0 1 + 1
Assuming that Pi Han Goh doesn't count k = 1 as a solution, the 1 4 th value of k in this list is 4 0