Timeline for Output nearby primes
Current License: CC BY-SA 2.5
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
S Feb 8, 2011 at 5:42 | history | suggested | moinudin | CC BY-SA 2.5 |
include newlines in character count
|
Feb 8, 2011 at 5:42 | comment | added | fR0DDY | I paste the code in Ideone and copy the characteres count from there. Sorry about that. | |
Feb 8, 2011 at 5:41 | comment | added | JPvdMerwe |
After you've fixed your count you can try replacing line 2 with f=lambda n:not all(n%x for x in range(2,n)) and lines 3 and 4 with: exec"n-=f(n);m+=f(m);"*m
|
|
Feb 7, 2011 at 21:02 | comment | added | moinudin | Also, please count newlines in your character count. -1 for deceiving others. | |
Feb 7, 2011 at 21:01 | comment | added | moinudin | @fR0DDY Please don't list all your intermediate solutions as they're viewable in the edit history if anyone wants to see them. | |
Feb 7, 2011 at 21:01 | comment | added | JPvdMerwe |
You don't count new lines. Actual count is 108 .
|
|
Feb 7, 2011 at 21:00 | review | Suggested edits | |||
S Feb 8, 2011 at 5:42 | |||||
Feb 7, 2011 at 14:01 | history | edited | fR0DDY | CC BY-SA 2.5 |
added 163 characters in body
|
Feb 7, 2011 at 13:45 | comment | added | st0le |
and maybe you can replace not(all(...)) by any(...) reversing the booleans
|
|
Feb 7, 2011 at 13:41 | comment | added | st0le |
@fR0DDY, instead of the first 3 lines use n=input()-1 and m=n+2 , saves 3 chars...i think.
|
|
Feb 7, 2011 at 11:57 | history | edited | fR0DDY | CC BY-SA 2.5 |
added 207 characters in body; deleted 1 characters in body
|
Feb 7, 2011 at 9:45 | comment | added | st0le |
use f=lambda n:not(all(pow(b,n-1,n)<2for b in(3,5,7,13)))
|
|
Feb 7, 2011 at 5:08 | history | edited | fR0DDY | CC BY-SA 2.5 |
deleted 21 characters in body
|
Feb 7, 2011 at 5:02 | history | answered | fR0DDY | CC BY-SA 2.5 |