Lengthy Sum

Find the sum of all the numbers greater than 10000 formed with the digits 0, 2, 4, 6 and 8. Digits are not repeated.


The answer is 5199960.

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.

4 solutions

Aniket Verma
Feb 22, 2015

Sum of all numbers formed using digits \text{Sum of all numbers formed using digits} 0 , 2 , 4 , 6 & 8 = ( 0 + 2 + 4 + 6 + 8 ) × ( 4 ! ) × ( 11111 ) = 5333280 0,2,4,6\& 8 = (0+2+4+6+8)\times (4!)\times (11111) = 5333280
\\

sum of all numbers formed by given digits which are less than \text{sum of all numbers formed by given digits which are less than} 10000 all 4 digit numbers 10000 ~ \text{{all 4 digit numbers }} = ( 2 + 4 + 6 + 8 ) × ( 3 ! ) × ( 1111 ) = 133320 = (2+4+6+8)\times (3!)\times (1111) = 133320
\\

Hence required sum \text{Hence required sum} = ( 5333280 ) ( 133320 ) = 5199960 = (5333280)-(133320) = 5199960

Since, this may go really messy, I would solve this question step by step, So please bear with me!

For Ones place:

When an 8 8 is placed, the total amount of numbers formed = 3 × 3 × 2 × 1 = 18 3\times 3\times 2\times 1\quad =\quad 18

When a 6 6 is placed, the total amount of numbers formed = 3 × 3 × 2 × 1 = 18 3\times 3\times 2\times 1\quad =\quad 18

When a 4 4 is placed, the total amount of numbers formed = 3 × 3 × 2 × 1 = 18 3\times 3\times 2\times 1\quad =\quad 18

When a 2 2 is placed, the total amount of numbers formed = 3 × 3 × 2 × 1 = 18 3\times 3\times 2\times 1\quad =\quad 18

When a 0 0 is placed, the total amount of numbers formed = 4 × 3 × 2 × 1 = 24 4\times 3\times 2\times 1\quad =\quad 24

Sum at one's place = ( 8 + 6 + 4 + 2 ) 18 + ( 0 ) 24 = 20 × 18 (8+6+4+2)18+(0)24\quad =\quad 20\times 18 --------- 1. 1.

This same pattern will be followed for the ten's, the hundred's and the thousand's place. So, using the same formula:

Sum at ten's place = ( ( 8 + 6 + 4 + 2 ) 18 + ( 0 ) 24 ) × 10 = 200 × 18 ((8+6+4+2)18+(0)24)\times 10\quad =\quad 200\times 18 ----------- 2. 2.

Sum at hundred's place = ( ( 8 + 6 + 4 + 2 ) 18 + ( 0 ) 24 ) × 100 = 2000 × 18 ((8+6+4+2)18+(0)24)\times 100\quad =\quad 2000\times 18 ----------- 3. 3.

Sum at thousand's place = ( ( 8 + 6 + 4 + 2 ) 18 + ( 0 ) 24 ) × 1000 = 20000 × 18 ((8+6+4+2)18+(0)24)\times 1000\quad =\quad 20000\times 18 ----------- 4. 4.

Now for the ten thousand's place:

When an 8 8 is placed, the total amount of numbers formed = 4 × 3 × 2 × 1 = 24 4\times 3\times 2\times 1\quad =\quad 24

When a 6 6 is placed, the total amount of numbers formed = 4 × 3 × 2 × 1 = 24 4\times 3\times 2\times 1\quad =\quad 24

When a 4 4 is placed, the total amount of numbers formed = 4 × 3 × 2 × 1 = 24 4\times 3\times 2\times 1\quad =\quad 24

When a 2 2 is placed, the total amount of numbers formed = 4 × 3 × 2 × 1 = 24 4\times 3\times 2\times 1\quad =\quad 24

Sum at ten thousand's place = ( ( 8 + 6 + 4 + 2 ) × 24 ) × 10000 = 20000 × 24 ((8+6+4+2)\times 24)\times 10000\quad =\quad 20000\times 24 ------------- 5. 5.

Total sum = 1. + 2. + 3. + 4. + 5. 1.+2.+3.+4.+5.

= 360 + 3600 + 36000 + 360000 + 4800000 360+3600+36000+360000+4800000

= 36 × ( 10 + 100 + 1000 + 10000 ) + 4800000 36\times (10+100+1000+10000) + 4800000

= 36 × ( 11110 ) + 4800000 36\times (11110) + 4800000

= 399960 + 4800000 399960+4800000

= 5199960 5199960

CHEERS!:)

YO!! I did it exactly the same way!

shuvayan ghosh dastidar - 6 years, 3 months ago

Log in to reply

Haha...Well done @shuvayan ghosh dastidar !!:D:D

A Former Brilliant Member - 6 years, 3 months ago
Breno Senna
Feb 21, 2015

De acordo com a permutação simples, teríamos 5 ! 5! possibilidades de números distintos com 5 dígitos diferentes, porém um desses é 0 0 , que à esquerda não vale nada, logo o total passa a ser 4 4 3 2 1 = 96 4*4*3*2*1 = 96 números. Agora vem a parte mais chatinha, pois precisamos descobrir a soma dos mesmos.

Partindo das unidades, escolhemos qualquer algorismo para ser fixo a fim de teste, por exemplo o 2 2 :

? ? ? ? 2 \boxed{?}\boxed{?}\boxed{?}\boxed{?}\boxed{2}

Novamente relembrando, como 0 0 não pode ser o primeiro dígito, temos 3 3 2 1 = 18 3*3*2*1 = 18 números que terminam em 2 2 . Assim, 18 2 18*2 é a soma de todas as casas decimais de valor 2 2 .

Repetimos o procedimento para todos os outros dígitos, então temos que a soma de todas as casas decimais dos 96 números é:

18 2 + 18 4 + 18 6 + 18 8 18*2+18*4+18*6+18*8

ou

18 ( 2 + 4 + 6 + 8 ) = 360 = 36 10 18(2+4+6+8) = 360 = 36*10

O procedimento para as demais casas dos números é bastante similar, apenas utilizamos a potência de 10 para ajustar o valor real da sua posição.

18 20 10 = 3.600 = 36 1 0 2 18*20*10 = 3.600 = 36*10^{2}

18 20 1 0 2 = 36.000 = 36 1 0 3 18*20*10^{2} = 36.000 = 36 *10^{3}

18 20 1 0 3 = 360.000 = 36 1 0 4 18*20*10^{3} = 360.000 = 36 * 10^{4}

Até agora já calculamos o valor de 18 4 18*4 números, faltam os terminados em 0 0 .

Sendo esse o último dígito, teríamos mais números, pois desse modo garantíamos que ele não seria o primeiro, e assim teremos apenas números válidos para a condição de valor > 10.000 >10.000 .

? ? ? ? 0 \boxed{?}\boxed{?}\boxed{?}\boxed{?}\boxed{0}

4 3 2 1 = 24 4*3*2*1 = 24

Logo,

24 20 1 0 4 = 4.800.000 24*20*10^{4} = 4.800.000

Agora somamos tudo

4.800.000 + 36 11.110 = 5.199.960 4.800.000 + 36*11.110 = 5.199.960

:) Espero ter ajudado, abraços!

Brock Brown
Feb 21, 2015

Python:

1
2
3
4
5
6
7
from itertools import permutations
total = 0
for combo in permutations('02468'):
    test = int(''.join(combo))
    if test > 10000:
        total += test
print "Answer:", total

Whenever I've seen a solution by you, why has it always been Python ?

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

Because it's my favorite way to solve things. I use this site mainly to practice my programming. I'm not great at traditional mathematical thinking, so I get around that problem with Python.

I know it's not a good idea to use Python as a crutch, but I enjoy it. :D

Brock Brown - 6 years, 3 months ago

Log in to reply

where can i learn python ????? cuz i want to

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad Here you go:

Learn Python the Hard Way: http://learnpythonthehardway.org/book/

MIT's Introduction to Python: https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-0#.VNtP4np6jqA

MIT's Introduction to Algorithms: http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/

The Python documentation is also very thorough: https://docs.python.org/2.7/

If you have any questions, don't hesisitate to ask:

brockrbrown@gmail.com

Brock Brown - 6 years, 3 months ago

Log in to reply

@Brock Brown whoa....ok. thanks a lot

Vaibhav Prasad - 6 years, 3 months ago

Log in to reply

@Vaibhav Prasad No problem. Good luck.

Brock Brown - 6 years, 3 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...