shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] projecteuler.net


From: Ultimo de Miranda
Subject: Re: [shell-script] projecteuler.net
Date: Wed, 02 Sep 2015 13:31:28 -0300

Não sei onde estou errando nesse ...



A perfect number is a number for which the sum of its proper divisors is
exactly equal to the number. For example, the sum of the proper divisors
of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect
number.

A number n is called deficient if the sum of its proper divisors is less
than n and it is called abundant if this sum exceeds n.

As 12 is the smallest abundant number, 1 + 2 + 3 + 4 + 6 = 16, the
smallest number that can be written as the sum of two abundant numbers
is 24. By mathematical analysis, it can be shown that all integers
greater than 28123 can be written as the sum of two abundant numbers.
However, this upper limit cannot be reduced any further by analysis even
though it is known that the greatest number that cannot be expressed as
the sum of two abundant numbers is less than this limit.

Find the sum of all the positive integers which cannot be written as the
sum of two abundant numbers.

Coloquei em um array todos os numeros abundantes até a metade de 28123
Colquei em outro array de 1  até 28123 de indice todos com valor 1
Percorri o primeiro array duas vezes , tomando a soma (soma 2 a 2 , na
verdade ) e colocando no segundo na posiçao da soma , o valor 0 .
depois percorri o segundo array e somei sempre que o conteúdo era 1
Resultado : 31531501
que está errado    :(



On Thu, 2015-08-13 at 11:45 -0300, Ultimo de Miranda
address@hidden [shell-script] wrote:
>   
> Estou me divertindo com esse aqui agora .
> Se alguém puder ( e quiser ) entrar na diversão ...
> Ainda não pensei em nada ainda .
> 
> A palindromic number reads the same both ways. The largest palindrome
> made from the product of two 2-digit numbers is 9009 = 91 × 99.
> 
> Find the largest palindrome made from the product of two 3-digit
> numbers
> 
> 
> 
> 
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]