[Python] Project Euler [WAS: Come iniziare]
Stefano Dal Pra
s.dalpra a gmail.com
Ven 13 Feb 2015 10:39:34 CET
On Fri, Feb 13, 2015 at 10:32 AM, Stefano Dal Pra <s.dalpra a gmail.com>
wrote:
>
>
> 2015-02-13 10:27 GMT+01:00 Stefano Dal Pra <s.dalpra a gmail.com>:
>
>>
>>
>>
>> On Fri, Feb 13, 2015 at 10:15 AM, Marco Beri <marcoberi a gmail.com> wrote:
>>
>>> 2015-02-13 9:50 GMT+01:00 Diego Barrera <diegonebarrera a yahoo.it>:
>>>
>>>> |print sum([xfor xin xrange(3,1000,3)if not x %3 or not x %5])|
>>>
>>>
>>> Ahia.... ecco... sei già drogato :-)
>>>
>>> Lancio una sfida qui: chi riesce a risolvere il numero 16 in meno
>>> caratteri?
>>>
>>> https://projecteuler.net/problem=16
>>>
>>> Ciao.
>>> Marco.
>>>
>>
>> Io dico 33
>> >>> sum(int(c) for c in "%d"%2**1000)
>> 1366
>>
>> >>> 'sum(int(c) for c in "%d"%2**1000)'.__len__()
>> 33
>>
>> Stefano
>>
>> Rilancio con 28:
>
> >>> sum(map(int,"%d"%(2**1000)))
> 1366
> >>> 'sum(map(int,"%d"%(2**1000)))'.__len__()
> 28
>
> E chiudo con 26
>>> sum(map(int,str(2**1000)))
1366
>>> len('sum(map(int,str(2**1000)))')
26
>
>
>>
>>> --
>>> http://beri.it/ - Un blog
>>> http://beri.it/i-miei-libri/ - Qualche libro
>>> http://beri.it/articoli/ - Qualche articolo
>>>
>>> _______________________________________________
>>> Python mailing list
>>> Python a lists.python.it
>>> http://lists.python.it/mailman/listinfo/python
>>>
>>>
>>
>
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <http://lists.python.it/pipermail/python/attachments/20150213/689def82/attachment.html>
Maggiori informazioni sulla lista
Python