Jump to content

Search the Community

Showing results for tags 'Fibonacci number sequence'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum
  • AutoIt

Calendars

  • Community Calendar

Found 1 result

  1. This function will calculate the Finonacci number based on a decimal value. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Fibonacci ; Description ...: Calculate the Fibonacci number of a decimal value. ; Syntax ........: _Fibonacci($iIterations) ; Parameters ....: $iIterations - An integer value to iterate to. ; Return values .: Success - Fibonacci value ; Author ........: guinness & UEZ ; Link ..........: C++ example: https://en.wikipedia.org/wiki/Functional_programming#Coding_styles ; Example .......: Yes ; =============================================================================================================================== Func _Fibonacci($iIterations) $iIterations = Int($iIterations) Local $iFirst = 0, $iSecond = 1, $iSum = 0 If $iIterations > 92 Then $iSecond = 1.0 EndIf For $i = 0 To ($iIterations - 1) $iSum = $iFirst + $iSecond $iFirst = $iSecond $iSecond = $iSum Next Return $iFirst EndFunc ;==>_FibonacciFunction V3.9.9.4+ ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Fibonacci ; Description ...: Calculate the Fibonacci number of a decimal value. ; Syntax ........: _Fibonacci($iIterations) ; Parameters ....: $iIterations - An integer value to iterate to. ; Return values .: Success - Fibonacci value ; Author ........: guinness & trancexx ; Link ..........: C++ example: https://en.wikipedia.org/wiki/Functional_programming#Coding_styles ; Example .......: Yes ; =============================================================================================================================== Func _Fibonacci($iIterations) $iIterations = Int($iIterations) Local $iFirst = 0, $iSecond = ($iIterations > 92) ? 1.0 : 1, $iSum = 0 For $i = 0 To ($iIterations - 1) $iSum = $iFirst + $iSecond $iFirst = $iSecond $iSecond = $iSum Next Return $iFirst EndFunc ;==>_FibonacciExample use of Function: For $i = 0 To 20 ConsoleWrite($i & ' >> ' & _Fibonacci($i) & @CRLF) Next
×