e2e4au Posted August 18, 2005 Share Posted August 18, 2005 ; Fibonacci number generator, first 50 only #include <array.au3> Dim $fib1 = 1, $fib2 = 2, $fib3, $results[51], $temp $results[1] = $fib1 $results[2] = $fib2 For $temp = 3 To 50 $fib3 = $fib1 + $fib2 $results[$temp] = $fib3 swap($fib1, $fib2, $fib3) Next _ArrayDisplay($results, "50 Fibonacci Numbers") Func swap(ByRef $a, ByRef $b, ByRef $c) $a = $b $b = $c EndFunc ;==>swap Link to comment Share on other sites More sharing options...
peethebee Posted August 18, 2005 Share Posted August 18, 2005 Nice script. Keep it up! peethebee vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Link to comment Share on other sites More sharing options...
erifash Posted August 18, 2005 Share Posted August 18, 2005 I have made something like that before, using an algorithm like this: $a = 1 $b = 1 While 1 $c = $a + $b $b = $c + $a $a = $b + $c Wend1 + 1 = 2 2 + 1 = 3 3 + 2 = 5 5 + 3 = 8 8 + 5 = 13 ...Very nice work though! I never thought about using arrays... My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver Link to comment Share on other sites More sharing options...
BillLuvsU Posted August 19, 2005 Share Posted August 19, 2005 I really don't want to seem rude but what exactly is the fibboncci (did I spell that right?) sequence good for ? I have heard about it several times but am not sure what it couldbe used for. Any idea or explanation will be appreciated, ty . [center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw Link to comment Share on other sites More sharing options...
Celeri Posted August 21, 2005 Share Posted August 21, 2005 I really don't want to seem rude but what exactly is the fibboncci (did I spell that right?) sequence good for ? I have heard about it several times but am not sure what it couldbe used for. Any idea or explanation will be appreciated, ty .<{POST_SNAPBACK}>No, excellent question... I've seen this in fractint (program to make fractal imagery) but I still don't know exactly what it is for ... Hey anyone enough to make a fractal generator in AutoIt3? That WOULD be cool! Oh it needs to spin in 3d too (just kidding) I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!) Link to comment Share on other sites More sharing options...
Celeri Posted August 21, 2005 Share Posted August 21, 2005 Ok here's something like 200 pages worth of information on Fibonacci numbers ...Fibonacci Numbers and the Golden Section Can you believe it all started with someone observing rabbits?And here's that program I lost so much time on trying different formulas and combinations ... WELCOME to the Fractint WWW pages Really an awesome program. Look ma, no drugs I am endeavoring, ma'am, to construct a mnemonic circuit using stone knives and bearskins.SpockMy UDFs:Deleted - they were old and I'm lazy ... :)My utilities:Comment stripperPolicy lister 1.07AutoIT Speed Tester (new!) Link to comment Share on other sites More sharing options...
eliasn Posted December 20, 2019 Share Posted December 20, 2019 thx, small change for n fibonacci: Fibonacci(14,1) Func Fibonacci($limit=50,$display=0) Dim $fib1 = 1, $fib2 = 2, $fib3, $results[$limit], $temp $results[0] = $fib1 $results[1] = $fib2 For $temp = 2 To $limit-1 $fib3 = $fib1 + $fib2 $results[$temp] = $fib3 swap($fib1, $fib2, $fib3) Next If $display == 1 Then _ArrayDisplay($results, $limit & " Fibonacci Numbers") EndIf Return $results EndFunc Func swap(ByRef $a, ByRef $b, ByRef $c) $a = $b $b = $c EndFunc ;==>swap Link to comment Share on other sites More sharing options...
Musashi Posted December 20, 2019 Share Posted December 20, 2019 This could probably be the new forum record for necroposting. 14 Years und 4 Month - Respect 😀! "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 20, 2019 Moderators Share Posted December 20, 2019 FYI necro-posting, while against forum etiquette, is really not report-worthy. A gentle statement for new folks is enough. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts