Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
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  -  Translate all to Translated (View all originals)
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
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
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
©2009 Google