On 2015-05-01, Peter Otten <__pete...@web.de> wrote:
> A computer that cannot calculate a lookup table with all 3-digit cases
> should be almost as hard to find as the one needed by Jon ;)
... or anyone else writing code to return the set of happy numbers.
--
https://mail.python.org/mailman/list
Ian Kelly wrote:
> On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano
> wrote:
>> Rather than 10**7, how about trying (10**500 + 2). Is it happy?
>>
>> Using the Python code from Wikipedia:
>> https://en.wikipedia.org/wiki/Happy_number
>>
>> SQUARE = dict([(c, int(c)**2) for c in "0123456789"])
>> d
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano
wrote:
> Rather than 10**7, how about trying (10**500 + 2). Is it happy?
>
> Using the Python code from Wikipedia:
> https://en.wikipedia.org/wiki/Happy_number
>
> SQUARE = dict([(c, int(c)**2) for c in "0123456789"])
> def is_happy(n):
> while (n
On Fri, 1 May 2015 05:23 pm, Jon Ribbens wrote:
> On 2015-04-30, Dave Angel wrote:
>> On 04/30/2015 07:31 PM, Jon Ribbens wrote:
>>> On 2015-04-30, Dave Angel wrote:
But the real reason I didn't like it was it produced a much larger
set of happy_numbers, which could clog memory a lot s
On 2015-04-30, Dave Angel wrote:
> On 04/30/2015 07:31 PM, Jon Ribbens wrote:
>> On 2015-04-30, Dave Angel wrote:
>>> But the real reason I didn't like it was it produced a much larger
>>> set of happy_numbers, which could clog memory a lot sooner. For
>>> 10**7 items, I had 3250 happy members,
Op Friday 1 May 2015 01:52 CEST schreef Dave Angel:
> On 04/30/2015 07:31 PM, Jon Ribbens wrote:
>> On 2015-04-30, Dave Angel wrote:
>>> Finally, I did some testing on Jon Ribben's version. His was
>>> substantially faster for smaller sets, and about the same for
>>> 10*7. So it's likely it'll be
On 04/30/2015 07:31 PM, Jon Ribbens wrote:
On 2015-04-30, Dave Angel wrote:
Finally, I did some testing on Jon Ribben's version. His was
substantially faster for smaller sets, and about the same for 10*7. So
it's likely it'll be slower than yours and mine for 10**8.
You know what they say a
On 2015-04-30, Dave Angel wrote:
> Finally, I did some testing on Jon Ribben's version. His was
> substantially faster for smaller sets, and about the same for 10*7. So
> it's likely it'll be slower than yours and mine for 10**8.
You know what they say about assumptions. Actually, my version
On 04/30/2015 04:35 PM, Cecil Westerhof wrote:
Op Thursday 30 Apr 2015 20:53 CEST schreef Dave Angel:
Finally, I did some testing on Jon Ribben's version. His was
substantially faster for smaller sets, and about the same for 10*7.
So it's likely it'll be slower than yours and mine for 10**8. B
Op Thursday 30 Apr 2015 20:53 CEST schreef Dave Angel:
> On 04/30/2015 11:59 AM, Cecil Westerhof wrote:
>> I implemented happy_number function:
>> _happy_set = { '1' }
>> _unhappy_set= set()
>>
>> def happy_number(n):
>> """
>> Check if a number is a happy number
>> https://en.wikipedia.o
Op Thursday 30 Apr 2015 19:37 CEST schreef Ian Kelly:
Most I still have to digest. ;-)
> On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof wrote:
>> return (current_array, ''.join(current_array))
>
> You don't seem to be actually using current_array for anything, so
> why not just return the stri
On 04/30/2015 11:59 AM, Cecil Westerhof wrote:
I implemented happy_number function:
_happy_set = { '1' }
_unhappy_set= set()
def happy_number(n):
"""
Check if a number is a happy number
https://en.wikipedia.org/wiki/Happy_number
"""
On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof wrote:
> I implemented happy_number function:
> _happy_set = { '1' }
> _unhappy_set= set()
>
> def happy_number(n):
> """
> Check if a number is a happy number
> https://en.wikipedia.org/wiki/Happy_number
On 2015-04-30, Cecil Westerhof wrote:
> Besides it need some documentation: is it a good implementation? Or
> are there things I should do differently?
Here's an alternative implementation which is a bit neater:
def find_happy(maximum):
"""Return set of happy numbers between 1 and `m
I implemented happy_number function:
_happy_set = { '1' }
_unhappy_set= set()
def happy_number(n):
"""
Check if a number is a happy number
https://en.wikipedia.org/wiki/Happy_number
"""
def create_current(n):
current_array =
15 matches
Mail list logo