Timeline for Count sums of two squares
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:39 | history | edited | CommunityBot |
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
|
|
Dec 9, 2015 at 23:30 | comment | added | xnor |
@MitchSchwartz Yes, that's the optimization I was thinking of! And xsot's /4<<2 trick makes it shorter than what I had.
|
|
Dec 9, 2015 at 23:07 | comment | added | xsot | @MitchSchwartz I think that's an incredible improvement worthy of the bounty and likely the final optimisation xnor had in mind. | |
Dec 9, 2015 at 22:55 | comment | added | Mitch Schwartz | @xnor Is that the same idea as yours? | |
Dec 9, 2015 at 22:03 | comment | added | Mitch Schwartz |
(For positive n , can simplify f=lambda n,x=1:n/x and(n%x<1)*4-f(n,x+2) )
|
|
Dec 9, 2015 at 20:38 | comment | added | Mitch Schwartz |
I don't know whether I should make an answer of it, it's just your solution plus one trick: f=lambda n,x=1:+(x>n)or(n%x<1)-f(n,x+2)/4<<2 . Also, I guess we don't care about exceeding the default maximum recursion depth?
|
|
Dec 9, 2015 at 14:23 | comment | added | xnor | Whoa, that operator precedence. I don't have this trick but I have a different, bigger one. | |
Dec 9, 2015 at 11:32 | comment | added | xsot | @xnor Another byte down. I hope you don't have any more tricks up your sleeves. | |
Dec 9, 2015 at 11:30 | history | edited | xsot | CC BY-SA 3.0 |
added 9 characters in body
|
Dec 8, 2015 at 22:29 | comment | added | xnor | This is a great improvement. But, there is still a way to make it shorter, and I encourage you to look for it. | |
Dec 5, 2015 at 16:08 | history | edited | xsot | CC BY-SA 3.0 |
added 8 characters in body
|
Dec 5, 2015 at 15:33 | history | edited | xsot | CC BY-SA 3.0 |
added 86 characters in body
|
Nov 28, 2015 at 10:17 | history | answered | xsot | CC BY-SA 3.0 |