Jump to content

Recommended Posts

Posted

; 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

Posted

Nice script.

Keep it up!

peethebee

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

Posted

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...
Posted

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

Posted

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

Posted

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

  • 14 years later...
Posted

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

Posted

This could probably be the new forum record for necroposting.

14 Years und 4 Month - Respect 😀!

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...