Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[oneliners] prime genrator in 34 bytes

0 views
Skip to first unread message

Simon Strandgaard

unread,
Mar 23, 2005, 9:54:56 PM3/23/05
to
The previous record seen on http://rubygarden.org/ruby?OneLiners
seems to to have been 46 bytes (its unclear who the author was).


JIX proposed this 34 bytes long solution.
i=l=1;(l%i+=1)>i-2&&p(i)while l*=i

Congratulations Jix, it was entertaining me and flgr.


I proposed a 40 bytes solution that isn't endless:
l=1;2.upto(1000){|i|p i if l%i>i-2;l*=i}

--
Simon Strandgaard


0 new messages