# Fibonacci numbers with awk

seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}'
Another combination of seq and awk. Not very efficient, but sufficiently quick.
Sample Output
```1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657
46368
75025
121393
196418
317811
514229
832040
1346269
2178309
3524578
5702887
9227465
14930352
24157817
39088169
63245986
102334155
165580141
267914296
433494437
701408733
1134903170
1836311903
2971215073
4807526976
7778742049
12586269025```

14
2009-03-24 20:39:24

## 4 Alternatives + Submit Alt

• recursive version, "pure" AWK Show Sample Output

5
awk 'func f(n){return(n<2?n:f(n-1)+f(n-2))}BEGIN{while(a<24){print f(a++)}}'
· 2010-11-24 10:40:08
• Does not require input to function or complete. Number of iterations controlled by shell variable \$NUM. Show Sample Output

0
awk 'BEGIN {a=1;b=1;for(i=0;i<'\${NUM}';i++){print a;c=a+b;a=b;b=c}}'
· 2009-09-06 03:05:55

• 0
prev=0;next=1;echo \$prev;while(true);do echo \$next;sum=\$((\$prev+\$next));prev=\$next;next=\$sum;sleep 1;done
· 2009-09-06 09:38:10
• only take the first field on each row to compute the fibo on this number Show Sample Output

-5
gawk '{n=\$1;a=0;b=1;c=1;for(i=1;i<n;i++){c=a+b;a=b;b=c};print c}' << eof
· 2010-11-26 08:36:30

### What Others Think

The Fibononacci sequence is supposed to start from 0, not 1.
sharfah · 771 weeks ago
How can do i hack this pool ball game,now just one a single click on this site http://8ball-pool-hack.mystrikingly.com">pool 8 ball hack here the available simple way tips,now using.
KGF123 · 203 weeks and 4 days ago
Since 2008, Perfect House Pug Puppies has been the leading Pug puppy breeder in the US, providing premium Pug puppies for sale. Each puppy exhibits the professionalism and knowledge that have set Perfect House Pug puppies apart from other pug puppy breeders. The professionals at Perfect House Pug Puppies are dedicated about finding their puppies loving, beloved homes where they can enjoy long, healthy lives. A companion that has been produced for quality, health, and temperament that satisfies the breed standard is guaranteed by Perfect House Pug puppies, the pug breeder that has set the benchmark for exceptional customer satisfaction. If you are looking to buy a baby pug, Black and white pugs, Mini pug puppies for sale, Black and tan pug for sale, Teacup pug puppies for sale, Female pug puppies, pug puppies for sale, pug puppies for sale near me, pug puppies for sale under \$500 near me. Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under \$500 Near Me pug puppies for sale in texas pug puppies for sale \$200 pugs for sale near me under \$500 pugs for sale under \$400 near me pugs for sale near me puppies for sale near me under \$500 pug puppies for sale under \$1,000 near me pug for sale pug puppies for sale under \$300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under \$500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale \$200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 84 weeks and 5 days ago
Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. 3 Useful Tools For More Sales
seomind · 79 weeks and 5 days ago
This post is good enough to make somebody understand this amazing thing, and I’m sure everyone will appreciate this interesting things. 15 Second Free Leads Review
seomind · 79 weeks and 5 days ago
Thank you for the post. I will definitely comeback. online marketing
seomind · 79 weeks and 5 days ago
I just found this blog and have high hopes for it to continue. Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You. online marketing
seomind · 79 weeks and 5 days ago
This website and I conceive this internet site is really informative ! Keep on putting up! 15 Second Free Leads Review
seomind · 79 weeks and 5 days ago
I adore your websites way of raising the awareness on your readers. online marketing
seomind · 79 weeks and 5 days ago
This is really very nice post you shared, i like the post, thanks for sharing.. 15 Second Free Leads Review
seomind · 79 weeks and 5 days ago
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it. Lead Generation
seomind · 79 weeks and 5 days ago
I am overwhelmed by your post with such a nice topic. Usually I visit your blogs and get updated through the information you include but today’s blog would be the most appreciable. Well done! Lead Generation
seomind · 79 weeks and 5 days ago
You completed certain reliable points there. I did a search on the subject and found nearly all persons will agree with your blog. Lead Generation
seomind · 79 weeks and 5 days ago
This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck Invincible Marketer Review
seomind · 54 weeks and 4 days ago
Very nice article. I enjoyed reading your post. very nice share. I want to twit this to my followers. Thanks !. Invincible Marketer Review
seomind · 54 weeks and 4 days ago
Really appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good. ARBOR ACADEMY REVIEW
seomind · 54 weeks and 4 days ago
Three are usually cheap Ralph Lauren available for sale each and every time you wish to buy. ARBOR ACADEMY REVIEW
seomind · 54 weeks and 4 days ago
I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it. ARBOR ACADEMY REVIEW
seomind · 54 weeks and 4 days ago
If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries ARBOR ACADEMY REVIEW
seomind · 54 weeks and 4 days ago
Your work is very good and I appreciate you and hopping for some more informative posts ARBOR ACADEMY REVIEW
seomind · 54 weeks and 4 days ago
Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming. Scam Risk
seomind · 54 weeks and 4 days ago
Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Scam Risk
seomind · 54 weeks and 4 days ago
There's no doubt i would fully rate it after i read what is the idea about this article. You did a nice job.. POWER LEAD SYSTEM REVIEW
seomind · 54 weeks and 4 days ago
EVERYONE in the family Priority number one. We're small-scale, in-home breeders. We're not a facility or a kennel; we're a group of Pug enthusiasts who are utterly smitten with our adorable kids. Perfect House of Pugs is just breathtaking! Our Pugs have the best temperaments and personalities. They are created specifically for families looking for a high-quality Pug puppy. With over 18+ years, we have fought for only the finest standards, with our Pugs' health as our primary emphasis, which is why we put EVERYTHING into it, never cutting corners, always changing, and always improving. Our children are our greatest source of pride and delight. Our mission is to build connections (rather than merely sell puppies) and to bring pleasure and joy into your household. We are raising a Pug family and are certain that these puppies will become an integral part of your life. PLEASE VISIT OUR WEBSITE LINK BELLOW FOR MORE INFORMATION ABOUT PUG PUPPIES. PUG PUPPY ADOPTION Pug puppies for sale PUG PUPPIES FOR SALE NEAR ME PUG PUPPIES NEAR ME PUG PUPPIES FOR SALE UNDER 500 NEAR ME CUTE PUG PUPPIES BLACK PUG PUPPIES BLACK PUG PUPPIES FOR SALE PUG PUPPIES FOR ADOPTION BLACK PUG PUPPIES FOR SALE NEAR ME CHIHUAHUA PUG MIX PUPPIES TEACUP PUG PUPPIES HOW MUCH IS A PUG PUPPY BABY PUG PUPPIES PICTURES OF PUG PUPPIES PUG PUPPIES FOR SALE IN OHIO PUG PUPPIES FOR SALE IN PA PUG PUPPIES PRICE PUG MIX PUPPIES TEACUP PUG PUPPIES FOR SALE BABY PUG PUPPIES FOR SALE BEST FOOD FOR PUG PUPPY NEWBORN PUG PUPPIES PUG PUPPIES CRAIGSLIST PUG PUPPIES FOR SALE CRAIGSLIST WHITE PUG PUPPIES PUG PUPPIES FOR SALE IN MICHIGAN PUG PUPPIES FOR SALE UNDER 500 ADORABLE PUG PUPPIES BRINDLE PUG PUPPY HOW MUCH DOES A PUG PUPPY COST PITBULL PUG MIX PUPPIES PUGS FOR SALE NEAR ME PUG PUPPIES FOR SALE 200 PUG PUPPIES FOR SALE IN NJ PUG PUPPIES FOR SALE IN WISCONSIN PUG PUPPIES MICHIGAN PUG PUPPY COST MERLE PUG PUPPY FOR ADOPTION BEST PUG PUPPY FOOD ROYAL CANIN PUG PUPPY FOOD FAWN PUG PUPPY PUG PUPPIES FOR SALE FLORIDA PUG PUPPIES FOR SALE IN INDIANA PUG PUPPIES FOR SALE IN KY PUG PUPPIES FOR SALE IN NC PUG PUPPIES FOR SALE IN TEXAS PUG PUPPIES FOR SALE MN PUG DOG PUPPY AKC REGISTERED PUG PUPPIES FOR SALE PUG ALL BLACK CHEAP PUG PUPPIES FOR SALE NEAR ME PUGS PUPPIES FOR SALE CHEAP PUG PUPPIES FOR SALE IN CALIFORNIA MINIATURE PUG PUPPIES FOR SALE NEAR ME MINIATURE PUG PUPPIES FOR SALE CHEAP PUG PUPPIES FOR SALE IN NJ KNOWN FACTS ABOUT PUG PUPPIES ADOPT PUG PUPPIS RESCUE A PUG PUPPY PERFECT HOUSE OF PUGS PUG PUPPIES INSTAGRAM PINTEREST QUORA Google Page USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA USA
pugpuppies95 · 46 weeks and 4 days ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
KarinTaufik12 · 23 weeks and 3 days ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
rina · 23 weeks and 3 days ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
oladewi · 23 weeks and 3 days ago

### What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

### What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.