Sign in to follow this  
Followers 0
e2e4au

Simple Fibonacci genertor

6 posts in this topic

; 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

Share this post


Link to post
Share on other sites



Nice script.

Keep it up!

peethebee


vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Share this post


Link to post
Share on other sites

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
Wend
1 + 1 = 2
2 + 1 = 3
3 + 2 = 5
5 + 3 = 8
8 + 5 = 13
...
Very nice work though! I never thought about using arrays...

Share this post


Link to post
Share on other sites

I really don't want to seem rude but what exactly is the fibboncci (did I spell that right?) sequence good for :whistle:? I have heard about it several times but am not sure what it couldbe used for. Any idea or explanation will be appreciated, ty :dance: .


[center][/center]Working on the next big thing.Currently Playing: Halo 4, League of LegendsXBL GT: iRememberYhslaw

Share this post


Link to post
Share on other sites

I really don't want to seem rude but what exactly is the fibboncci (did I spell that right?) sequence good for :dance:? 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 ... :whistle:

Hey anyone :dance: 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!)

Share this post


Link to post
Share on other sites

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 :whistle:


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!)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0