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.
--
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info 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])
On 2015-04-30, Dave Angel da...@davea.name wrote:
On 04/30/2015 07:31 PM, Jon Ribbens wrote:
On 2015-04-30, Dave Angel da...@davea.name 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
Ian Kelly wrote:
On Fri, May 1, 2015 at 2:27 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info 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
On Fri, 1 May 2015 05:23 pm, Jon Ribbens wrote:
On 2015-04-30, Dave Angel da...@davea.name wrote:
On 04/30/2015 07:31 PM, Jon Ribbens wrote:
On 2015-04-30, Dave Angel da...@davea.name wrote:
But the real reason I didn't like it was it produced a much larger
set of happy_numbers, which could
On 2015-04-30, Cecil Westerhof ce...@decebal.nl 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
On Thu, Apr 30, 2015 at 9:59 AM, Cecil Westerhof ce...@decebal.nl wrote:
I implemented happy_number function:
_happy_set = { '1' }
_unhappy_set= set()
def happy_number(n):
Check if a number is a happy number
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 ce...@decebal.nl wrote:
return (current_array, ''.join(current_array))
You don't seem to be actually using current_array for anything, so
why not just
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
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
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 da...@davea.name 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
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.
On 2015-04-30, Dave Angel da...@davea.name 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.
On 04/30/2015 07:31 PM, Jon Ribbens wrote:
On 2015-04-30, Dave Angel da...@davea.name 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
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