Largest palindrome that is sum of nine consecutive numbers

Logic Level 3

What is the largest palindrome that is smaller than 654321 and is a sum of nine consecutive integers?


The answer is 648846.

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.

5 solutions

Solomon Olayta
Aug 20, 2015

Since the palindrome is a sum of 9 consecutive integers, then it is of the form x +(x+1)+...+(x+8)= 9(x+4).Hence, it must be divisible by 9. We simply construct a palindrome less than and nearest to 654321 that is divisiblble by 9. The nearest is 648846.

Otto Bretscher
Aug 28, 2015

The first three digits must be the largest integer < 654 <654 that is divisible by 9 9 . This number is 648 648 , and the solution is 648846. 648846.

Jonathan Yim
Sep 1, 2015

The sum of 9 consecutive integers can be thought algebraically where 'x' is the original number, and (x+1), (x+2), (x+3)... are the following 8 consecutive numbers. Adding them together, we get (9x + 36).

Therefore, in order to satisfy this condition, we should be able to recreate the answer with (9x+36), where x is an integer. As 36 is already divisible by 9, this simplifies down to the fact that our answer must be divisible by 9.

Now, a quick way to find whether a number is divisible by 9 or not is to take its digital root. If the digital root is divisible by 9, the number itself is also divisible by 9.

First, let's assume the answer looks like '65xx56'. In this case, the digital root is 2x+22 In order for that to be divisible by 9, x=7 (2*7 + 22 = 36). However, 657756 > 654321.

The next biggest answer would be in the form of '64xx46'. Once again, checking the digital root, we find that it is 2x+20, and in order for the digital root to be divisible by 9, x=8 (2*8 + 20 = 36). As 648846 < 654321, that's our answer.

Code

1
2
3
4
5
6
for a in range(1,10):
    for b in range(0,10):
        for c in range(0,10):
            for n in range(1,72708):
                if ((100000*a+10000*b+1000*c+100*c+10*b+a)==9*n-36):
                    print ((100000*a+10000*b+1000*c+100*c+10*b+a))

Output

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
108801
117711
126621
135531
144441
153351
162261
171171
180081
189981
198891
207702
216612
225522
234432
243342
252252
261162
270072
279972
288882
297792
306603
315513
324423
333333
342243
351153
360063
369963
378873
387783
396693
405504
414414
423324
432234
441144
450054
459954
468864
477774
486684
495594
504405
513315
522225
531135
540045
549945
558855
567765
576675
585585
594495
603306
612216
621126
630036
639936
648846

Largest output

Largest output= 648846 \large{\boxed{\color{#D61F06}{648846}}}

Drumil Deshpande
Aug 29, 2015
  1. (x-4)+(x-3)+(x-2)+(x-1)+x+(x+1)+(x+2)+(x+3)+(x+4) = the palindrome
  2. => 9x is the palindrome
  3. => Sum of digits of palindrome is div by 9
  4. => it can be 9,18,27,36

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...