My flight out of Baltimore was delayed with mechanical trouble, so I set to work on a one liner to generate prime numbers, in the spirit of One line Fibonacci generator. Unfortunately, I was unable to get it down to a one liner, but it's still pretty damn compact and I am rather proud of it even if it didn't meet my goal of the single statement. 95 characters isn't that bad. And it's pretty fast, too.
++$";while($\=$/and$"++and$;=$"){ do{$;&=$|and last if!($"%$_)}for@_; push@_,$"and print$"if$;}
In reply to Prime number generator by jimt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |