Google Groups Home
Help | Sign in
prime genrator in 34 bytes
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Simon Strandgaard  
View profile
 More options Mar 23 2005, 9:54 pm
Newsgroups: comp.lang.ruby
From: Simon Strandgaard <neon...@gmail.com>
Date: Thu, 24 Mar 2005 11:54:56 +0900
Local: Wed, Mar 23 2005 9:54 pm
Subject: [oneliners] prime genrator in 34 bytes
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google