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
377
610
987
1597
2584
4181

Can you do better? What about different languages?

Update: it has been suggested that for languages such as Java and C to be included in this experiment, that only the total number of pure source characters be included in the count. Therefore my perl solution in the comments below has 56 pure source characters.

For more information on the Fibonacci Series see http://en.wikipedia.org/wiki/Fibonacci_number

-3Monkeys

Be Sociable, Share!
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (7 votes, average: 5.86 out of 10)
Loading...

215 Responses to “Fibonacci Series in One Line of Perl”

  1. ??? ???? ???? ???? ?? Says:

    Pretty! This was an extremely wonderful article. Many thanks for providing these details.

  2. ?????????????? Says:

    This is the perfect webpage for anybody who wants to understand this topic.
    You realize a whole lot its almost hard to argue with you
    (not that I really would want to…HaHa).
    You certainly put a new spin on a subject which has been written about for ages.
    Wonderful stuff, just excellent!

  3. webhosting,cheap webhosting,best webhosting,cheapest webhosting,cheap vps hosting,cheapest vps hosting,virtual private server,virtual private server hosting,vps hosting,vps,cheap xen vps,cheap kvm vps,cheap ovz vps,cheap openvz vps,cheap xen,cheap kvm,che Says:

    webhosting,cheap webhosting,best webhosting,cheapest webhosting,cheap vps hosting,cheapest vps hosting,virtual private server,virtual private server hosting,vps hosting,vps,cheap xen vps,cheap kvm vps,cheap ovz vps,cheap openvz vps,cheap xen,cheap kv…

    […]3monkeys » Fibonacci Series in One Line of Perl[…]

  4. Albores Says:

    essalam alykommon fre8re sid ahmed j’ai de9ja lu ce vous avez e9crie allah ma3ak et nous somme les e9lement de aiibleenda derrie8re vous pour toujourston fre8re Samir

  5. physical health Says:

    great points altogether, you just gained a logo new reader. What could you recommend in regards to your publish that you made some days ago? Any positive?

  6. child prostitution Says:

    You?re so cool! I do not believe I have read through something like this before. So nice to find someone with unique thoughts on this issue. Really.. thanks for starting this up. This website is one thing that?s needed on the internet, someone with some originality!

  7. Daniel Waisner Says:

    please come try my acceleration software!

  8. Malaysia remy hair weaving Says:

    Malaysia remy hair weaving

    3monkeys » Fibonacci Series in One Line of Perl

  9. Agustin Harcum Says:

    Hello my friend! I want to say that this post is awesome, nice written and include approximately all important infos. I would like to see more posts like this.

  10. Capsule Compatibili Says:

    I just want to mention I am just very new to blogs and honestly enjoyed your page. Most likely I’m likely to bookmark your site . You really have good posts. Regards for revealing your blog.

  11. Exede Says:

    I don’t know whether it’s just me or if everybody else experiencing issues with your blog. It appears like some of the text in your posts are running off the screen. Can somebody else please comment and let me know if this is happening to them too? This might be a problem with my browser because I’ve had this happen previously. Many thanks|

  12. Hobert Says:

    There is an ever growing need for garden upkeep services in and around area’s in upmarket and middle class area’s.

  13. learning numbers 1-20 Says:

    I run a blog that is very similar, is there any way you would write a guest post on it? Shoot me an email if you are interested!

  14. mitra@gmail.com Says:

    well… nothing to say but good work…

  15. tsttara6198513591.Soup.Io Says:

    tsttara6198513591.Soup.Io

    3monkeys » Fibonacci Series in One Line of Perl

Leave a Reply