Quick Search for:  in language:    
P4266,Calculates,Fibonacci,numbers,unlimited,
   Code/Articles ╗ |  Newest/Best ╗ |  Community ╗ |  Jobs ╗ |  Other ╗ |  Goto ╗ | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
.Net Stats

 Code: 164,675. lines
 Jobs: 538. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login





Latest Code Ticker for .Net.
Click here to see a screenshot of this code!Quadratic Equation Solver Plus
By d m on 4/6

(Screen Shot)

Click here to see a screenshot of this code!KServiceManager
By Kajal Sinha on 4/6

(Screen Shot)

Click here to see a screenshot of this code!KProxyServer
By Kajal Sinha on 4/6

(Screen Shot)

Tree ADT
By Andrew Powney on 4/5


Click here to see a screenshot of this code!Tetris Attack Demo
By John Shedletsky on 4/5

(Screen Shot)

Click here to see a screenshot of this code!NotePad
By Nabeel Asif on 4/5

(Screen Shot)

Click here to see a screenshot of this code!Remote Explorer with no Winsock
By Nicholas Afxentiou on 4/5

(Screen Shot)

Click here to see a screenshot of this code!H.D.I-hardiskin fo
By fbe1978@hotmail .com on 4/5

(Screen Shot)

Click here to see a screenshot of this code!FSO-Infosfiles
By fbe1978@hotmail .com on 4/5

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Free Magazine
FREE full subscription to Computer World Magazine!


The most comprehensive source of news and analysis on the technologies and management issues of information technology.
Click here for more information on a free full-year subscription!

See other free magazines available


Affiliate Sites

 
 
   

Fibonacci Function

Print
Email
 

Submitted on: 1/25/2004 3:31:52 PM
By: Paddy Pasqualmie 
Level: Intermediate
User Rating: Unrated
Compatibility:VB.NET

Users have accessed this code 958 times.
 
 
     Calculates Fibonacci numbers to unlimited precision in only 25 lines of code. Pretty fast also. Calculate F(100,000) in 2 seconds on a P4-2.66
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    //**************************************
    //     
    // Name: Fibonacci Function
    // Description:Calculates Fibonacci numb
    //     ers to unlimited precision in only 25 li
    //     nes of code. Pretty fast also. Calculate
    //     F(100,000) in 2 seconds on a P4-2.66
    // By: Paddy Pasqualmie
    //
    // Inputs:int32
    //
    // Returns:string
    //
    //This code is copyrighted and has    // limited warranties.Please see http://
    //     www.Planet-Source-Code.com/vb/scripts/Sh
    //     owCode.asp?txtCodeId=2010&lngWId;=10    //for details.    //**************************************
    //     
    
    Shared Function Fibonacci(ByVal n As Int32) As String
    Dim x((Int(n * 0.208988) \ 9) + 2) As Int32 : x(1) = 1
    Dim y((Int(n * 0.208988) \ 9) + 2) As Int32 : y(1) = 1
    Dim z((Int(n * 0.208988) \ 9) + 2) As Int32 : z(1) = 0
    Dim Result As String
    Dim MaxCount As Int32
    For iLoop As Int32 = 1 To n - 2
    MaxCount = (Int(iLoop * 0.208988) \ 9) + 2
    y.CopyTo(z, 0) : x.CopyTo(y, 0)
    For Count As Int32 = 1 To MaxCount - 1
    x(Count) = y(Count) + z(Count)
    Next
    For Count As Int32 = 1 To MaxCount - 1
    If x(Count) >= 1000000000 Then
    x(Count) = x(Count) - 1000000000
    x(Count + 1) = x(Count + 1) + 1
    End If
    Next
    Next
    For Count As Int32 = x.Length - 1 To 1 Step -1
    Result = Result & x(Count).ToString.PadLeft(9, "0")
    Next
    Result = Result.TrimStart("0")
    Return Result
    End Function


Other 2 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | .Net Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyrightę 1997-2004 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.