Dividing palindromes \orange{\overrightarrow{\green{\underleftarrow{\blue{\text{palindromes}}}}}} by 135?!

Algebra Level 2

How many five-digit \text{How many five-digit } palindromes \orange{\overrightarrow{\green{\underleftarrow{\blue{\text{palindromes}}}}}} are divisible by 135 ? \text{ are divisible by } 135 ?

58185 \Large \orange{\overrightarrow{\green{\underleftarrow{\blue{\text{58185}}}}}}

58185 ÷ 135 = 431 \large \blue{\text{58185}} \div 135 = \green{431}


The answer is 5.

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

Code:

1
2
3
4
5
6
7
8
9
for a in range(1,10):

    for b in range(0,10):

        for c in range(0,10):

            if ((((10000*a)+(1000*b)+(100*c)+(10*b)+(a))%135)==0):

                print (((10000*a)+(1000*b)+(100*c)+(10*b)+(a))) 

Output:

1
2
3
4
5
    54945
    55755
    56565
    57375
    58185 

similar solution

Oximas omar - 11 months, 3 weeks ago
Mahdi Raza
Jun 19, 2020

The divisibility rule for 135 = 5 × 27 135 = 5 \times 27 , must include the divisibility rules of 5 5 and 27 27 .

Divisibility for 5 5 :

Any number must end in 5 , 0 5, 0 . It must end with 5 5 because if it is 0 0 , the leading digit will also be a 0 0 thus making it a four-digit number. So, the palindrome is of the form: 5aba5 \Large{\orange{\overrightarrow{\green{\underleftarrow{\blue{\text{5aba5}}}}}}}

Divisibility for 27 27 :

The sum of its digits must be divisible by 27 27 . The maximum digit sum of any 5-digit number can be 45 < 27 ( 2 ) 45 < 27(2) , thus:

5+a+b+a+5 = 27 2a + b = 17 \begin{aligned} \Large{\blue{\text{5+a+b+a+5}} = 27} \\ \Large{\blue{\text{2a + b}} = 17} \end{aligned}

Solutions to: 2 a + b = 17 2a + b = 17 .=

We know that ( a , b ) (a,b) are single digit numbers, thus it is easy to enumerate all of the solutions

a = 0 b = 17 [Not accepted] a = 1 b = 15 [Not accepted] a = 3 b = 11 [Not accepted] a = 2 b = 13 [Not accepted] a = 4 b = 9 [Accepted] a = 5 b = 7 [Accepted] a = 6 b = 5 [Accepted] a = 7 b = 3 [Accepted] a = 8 b = 1 [Accepted] a = 9 b = 1 [Not accepted] \begin{aligned} a &= 0 \implies b= 17 &\red{\text{[Not accepted]}} \\ a &= 1 \implies b= 15 &\red{\text{[Not accepted]}} \\ a &= 3 \implies b= 11 &\red{\text{[Not accepted]}} \\ a &= 2 \implies b= 13 &\red{\text{[Not accepted]}} \\ a &= 4 \implies b= 9 &\green{\text{[Accepted]}} \\ a &= 5 \implies b= 7 &\green{\text{[Accepted]}} \\ a &= 6 \implies b= 5 &\green{\text{[Accepted]}} \\ a &= 7 \implies b= 3 &\green{\text{[Accepted]}} \\ a &= 8 \implies b= 1 &\green{\text{[Accepted]}} \\ a &= 9 \implies b= -1 &\red{\text{[Not accepted]}} \end{aligned}

Thus we see that there are: 5 solutions \boxed{5 \text{ solutions}}

@Mahdi Raza , how can I write solution where the code looks like in the Daily Challenge solutions of some people? I mean, how can the Python interface be pasted here? Thanks!

Vinayak Srivastava - 11 months, 3 weeks ago

Log in to reply

Look formatting guide

Mahdi Raza - 11 months, 3 weeks ago

Log in to reply

Thank you!

Vinayak Srivastava - 11 months, 3 weeks ago

add ``` at the beginning and end of the code snippet after simply pasting it in the answer NOTE: the symbol is not the single quotation mark ' its another symbol forgot what it's called, for me, this is at the top left under the escape key

Oximas omar - 11 months, 3 weeks ago

Log in to reply

sorry for the late reply. it's called a back quote

J L - 8 months, 4 weeks ago
Chew-Seong Cheong
Jun 20, 2020

We note that the multiples of 135 135 can either end with 0 0 or 5 5 . But ending with 0 0 is not acceptable because then the five-digit palindrome will start with 0 0 . Therefore the required palindrome multiples of 135 135 must end with 5 5 and start with 5 5 . That it is of the form 5 a b a 5 \overline{5aba5} . Since 135 135 is divisible by 9 9 , 5 a b a 5 \overline{5aba5} must also be divisible by 9 9 and its sum of digits ( 10 + 2 a + b (10+2a+b is also divisible by 9 9 . That is 2 a + b = 8 2a+b = 8 , 17 17 , or 26 26 . Now we have 5 a b a 5 = 50005 + 1010 a + 100 b = 50005 + 810 a + 100 ( 2 a + b ) \overline{5aba5} = 50005 +1010a + 100b = 50005 + 810a + 100(2a+b) Since 135 = 5 × 27 , 135 = 5 \times 27, ,

5 a b a 5 5 0 (mod 27) 10001 + 162 a + 20 ( 2 a + b ) 0 (mod 27) 11 + 20 ( 2 a + b ) 0 (mod 27) \begin{aligned} \frac {\overline{5aba5}}5 & \equiv 0 \text{ (mod 27)} \\ 10001 + 162a + 20(2a+b) & \equiv 0 \text{ (mod 27)} \\ 11 + 20(2a+b) & \equiv 0 \text{ (mod 27)} \end{aligned}

Consider the three cases of 2 a + b 2a+b , if 2 a + b = { 8 11 + 20 ( 8 ) 9 (mod 27) 17 11 + 20 ( 17 ) 0 (mod 27) 26 11 + 20 ( 26 ) 18 (mod 27) 2a+b = \begin{cases} 8 & \implies 11 + 20(8) \equiv \red 9 \text{ (mod 27)} \\ 17 & \implies 11 + 20(17) \equiv \blue 0 \text{ (mod 27)} \\ 26 & \implies 11 + 20(26) \equiv \red{18} \text{ (mod 27)} \end{cases}

Therefore there are solutions only when 2 a + b = 17 2a+b = 17 and the palindrome 135 135 -multiples are { 54945 55755 56565 57375 58185 \begin{cases} 54945 \\ 55755 \\ 56565 \\ 57375 \\ 58185 \end{cases} , altogether 5 \boxed 5 .


My Python code solution:

ohh interesting you worked through it backwards in your python code Brilliant as this website is called XD.

Oximas omar - 11 months, 3 weeks ago
Oximas Omar
Jun 20, 2020
1
2
3
4
5
6
7
8
for i in range(11,100):
    if(i % 10 != 0):
        for m in range(10):
            num = int(str(i)[::-1]+str(m)+str(i))
            if(num % 135 == 0):
                print(num)
                count += 1
print("count = " + str(count))

result

1
2
3
4
5
6
54945
55755
56565
57375
58185
count = 5

1
2
3
4
5
6
     cont = 0
     for i in range(10000,100000):
          if str(i) == str(i)[::-1] and i % 135 == 0:
          print(i)
          cont += 1
     print("Sol = " + str(cont))

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...