Skip to main content

Timeline for Calculating Collatz Cousins

Current License: CC BY-SA 3.0

13 events
when toggle format what by license comment
May 29, 2015 at 6:54 history edited Sp3000 CC BY-SA 3.0
added 43 characters in body
May 29, 2015 at 6:48 comment added Sp3000 @isaacg Oh wow, I'm slightly ashamed I didn't notice that :P
May 29, 2015 at 6:42 comment added isaacg I think the ~- is unnecessary because you're using integer division.
May 29, 2015 at 4:47 comment added Sp3000 @DLosc Ahaha thanks. I still swear there's got to be a better short-circuiting way though...
May 29, 2015 at 4:47 history edited Sp3000 CC BY-SA 3.0
added 25 characters in body
May 29, 2015 at 4:35 comment added DLosc Nice! Here's 2 more bytes off: f=lambda n,k=1:sorted([k][n:]or(k>4==k%6and f(n-1,~-k/3)or[])+f(n-1,k*2))
May 29, 2015 at 3:06 history edited Sp3000 CC BY-SA 3.0
deleted 1 character in body
May 29, 2015 at 2:55 history edited Sp3000 CC BY-SA 3.0
added 7 characters in body
May 29, 2015 at 2:38 history edited Sp3000 CC BY-SA 3.0
deleted 79 characters in body
May 29, 2015 at 2:30 comment added Sp3000 @DLosc I liked your idea and made it one better :)
May 29, 2015 at 2:29 history edited Sp3000 CC BY-SA 3.0
added 99 characters in body
May 29, 2015 at 2:00 comment added DLosc Interesting--my original solution is very similar, but (taking a couple optimizations from yours) comes out 2 bytes shorter: f=lambda d,n=1:d and sorted(sum((c(d-1,x)for x in[n*2]+[~-n/3][:n>4==n%6]),[]))or[n]. It's less efficient with the function calls but still does n = 30 in under a second.
May 29, 2015 at 1:44 history answered Sp3000 CC BY-SA 3.0