Quantcast
Channel: 3monkeys » Golf
Browsing latest articles
Browse All 2 View Live

Fibonacci Series in One Line of Perl

Not ground breaking but here are the first 20 terms in the Fibonacci Series. Code perl -e'@p=(0,1);until($#p>20){print"$p[-2]\n";push @p,$p[-2]+$p[-1]}' Output 0 1 1 2 3 5 8 13 21 34 55 89 144 233...

View Article



isPrime in One Line of Perl

As a follow up to Finding the first 20 terms in the Fibonacci Series, next in the 3Monkey Golf series — Determining if a number is prime. The following is a fairly simple Perl one liner to do the...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images