Showing posts with label Fibonacci Sequence. Show all posts
Showing posts with label Fibonacci Sequence. Show all posts

Sunday, September 14, 2025

RPN HP 12C: Fibonacci and Lucas Sequences

 RPN HP 12C: Fibonacci and Lucas Sequences



Golden Ratio, Formulas, and Sequences


Let φ be the Golden Ratio:

φ = (1 + √5) ÷ 2


Formulas and Sequences


Fibonacci Numbers:

Fn = (φ^n - (-φ)^-n) ÷ √5


F0 = 0

F1 = 1

F2 = 1

F3 = 2

F4 = 3

F5 = 5

F6 = 8

F7 = 13

F8 = 21

F9 = 34

F10 = 55


Lucas Numbers:

Ln = φ^n + (-1)^n × (1 ÷ φ^n)


P0 = 2

P1 = 1

P2 = 3

P3 = 4

P4 = 7

P5 = 11

P6 = 18

P7 = 29

P8 = 47

P9 = 76

P10 = 123


HP 12C Code: Fibonacci and Lucas Numbers


Stack: X: n


01:[    44, 1]: STO 1

02:[        1]: 1

03:[    44, 0]: STO 0

04:[        5]: 5

05:[   43, 21]: √

06:[44, 40, 0]: STO+ 0

07:[        2]: 2

08:[44, 10, 0]: STO÷ 0 // Golden Ratio


09:[    45, 0]: RCL 0

10:[    45, 1]: RCL 1

11:[       21]: y^x

12:[    44, 2]: STO 2

13:[    44, 3]: STO 3

14:[    45, 0]: RCL 0

15:[       16]: CHS

16:[    45, 1]: RCL 1

17:[       16]: CHS

18:[       21]: y^x

19:[44, 30, 2]: STO- 2

20:[        5]: 5

21:[   43, 21]: √

22:[44, 10, 2]: STO÷ 2

23:[    45, 2]: RCL 2

24:[       31]: R/S // Fibonacci Numbers


25:[        1]: 1

26:[       16]: CHS

27:[    45, 1]: RCL 1

28:[       21]: y^x

29:[    45, 3]: RCL 3

30:[       22]: 1/x

31:[       20]: ×

32:[44, 40, 3]: STO+ 3

33:[    45, 3]: RCL 3

34:[43, 33, 00]: GTO 00



Variables:

R0 = φ

R1 = n

R2 = Fn

R3 = Ln


Sources


"Generalizations of Fibonacci numbers". Wikipedia. https://en.wikipedia.org/wiki/Generalizations_of_Fibonacci_numbers#Fibonacci_integer_sequences Last Edited October 6, 2024. Accessed June 18, 2025


Olson, Scott. The Golden Section: Nature Greatest Secret. Wooden Books. Bloomsbury. New York, NY and London, UK. 2006. ISBN 978-0-8027-1539-5



Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

The author does not use AI engines and never will.

Saturday, May 31, 2025

Casio fx-991CW: Recurrence Sequences

Casio fx-991CW: Recurrence Sequences



Introduction


Today’s edition we will work with recurring sequences, which can take the form of:


u_n = f(u_n-1), with initial condition u0


u_n = f(u_n-1, u_n-2) with initial conditions u0, u1


In general:


u_n = f(u_n-1, u_n-2, … u_n-k) with initial conditions u0, u1, u2, …, u_n-(k-1)


There is no app on the Casio fx-991CW that is dedicated to be recurrence sequences.



Recurring Sequences the Quick and Easy Way with the Calculate App


A quick way to tackle recurrence sequences and involves the use of the last answers key ( [Ans] ). This works on recurrence sequences with only one initial condition, u0.


Start by entering u0 and press [ EXE ]. Then enter the recurrence function, using Ans as u_(n-1).


Example:

u_n = 0.75 * u_(n-1)^2 + 1.03 * u_(n-1) with u0 = 1


Settings: MathI/DecimalO (Input/Output), Number Format (Norm 1)


1 [ EXE ]


0.75×Ans²+1.03×Ans [ EXE ] (Disp: 1.78)

[ EXE ] (Disp: 4.2097)

[ EXE ] (Disp: 17.62717157)

[ EXE ] (Disp: 251.1938698)

[ EXE ] (Disp: 47582.49986)


Recurrence Sequences with the Spreadsheet App


A way to generate recurrence sequences is to use the Spreadsheet app. The app contains a spreadsheet of size 5 columns (A, B, C, D, E) by 45 rows. Depending on the number of the initial conditions, up to 44 terms can be generated.


For the purposes of this blog, we’ll use column A, but we can use any column, as long as there is memory in the Spreadsheet.


u_n = f(u_n-1), with initial condition u0


Set A1 as the value of u0.

At cell A2:

1. Press [ TOOLS ].

2. Select Fill Formula and press [ OK ].

3. Enter the recurrence function, using A1 as u_(n-1).

4. At the range, set as A2:A#, to create a list of #-1 terms. For example, the range A2:A11 to create a list of 10 terms.

5. Select Confirm and press [ OK ].


Example:


Under Show Cell, Value (using the [TOOLS] menu)


u_n = (u_(n-1) + 0.5) * u_(n-1) with u0 = 0.65 for 7 terms.


Cell A1 = 0.65

Cell A2:

Fill Formula:

Form = (A1+0.5)×A1

Range: A2:A8



A (display)

1

0.65

2

0.7475

3

0.93250625

4

1.335821031

5

2.452328343

6

7.240078475

7

56.03877556

8

3168.363754



u_n = f(u_n-1, u_n-2), with initial condition u0, u1


Set A1 as the value of u0.

Set A2 as the value of u1.

At cell A3:

1. Press [ TOOLS ].

2. Select Fill Formula and press [ OK ].

3. Enter the recurrence function, using A1 as u_(n-2) and A2 as u_(n-1).

4. At the range, set as A3:A#, to create a list of #-2 terms. For example, the range A2:A11 to create a list of 9 terms.

5. Select Confirm and press [ OK ].


Example:


u_n = u_(n-1) + u_(n-2), u0 =1 , u1 = 1 for 7 terms.

Yes, this is ripe for the Fibonacci sequence.


Cell A1 = 1

Cell A2 = 1

Cell A3:

Fill Formula:

Form = A1+A2

Range: A3:A9



A (display)

1

1

2

1

3

2

4

3

5

5

6

8

7

13

8

21

9

34



Until next time,


Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Sunday, December 5, 2021

HP 17B and HP 27S: Using the Solver for Recursive Functions

HP 17B and HP 27S: Using the Solver for Recursive Functions


Introduction


A simple store and recall procedure can be used with the solver.   


One Initial Condition


u_n = f(u_n-1) with the initial condition u_0


Let B = u_n and A = u_n-1, set up the solver as:


B = F(A)


Initial condition:

u_0 ( A ) ( B )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


*RCL B is not necessary if you go straight to the next calculation.  


Example:   

u_n = 4*u_n-1 - 3, u_0 = 3


Setup:  B=4×A-3


3 ( A ) ( B )

Result:  9


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  33


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  129


[ RCL ] ( B) [ STO ] ( A ) ( B )

Result:  513



Two Initial Conditions


u_n = f(u_n-1, u_n-2) with the initial conditions u_0 and u_1


Let C = u_n, B = u_n-1, and A = u_n-2 and set up the solver as:


C = F(A, B)


Initial condition:

u_0 ( A ) u_1 ( B )  ( C )


Subsequent calculations:

[ RCL ] ( B )* [ STO ] ( A ) ( B )


Example:


The Fibonacci Sequence:

u_n = u_n-1 + u_n-2; with u_0 = 1, u_1 = 1


Setup:  C=B+A


1 ( A ) 1 ( B ) ( C )

Result: 2


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  3



[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  5


[ RCL ] ( B ) [ RCL ] ( A ) ( C )

Result:  8


Nothing to it.


Eddie 


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


RPN HP 12C: Fibonacci and Lucas Sequences

  RPN HP 12C: Fibonacci and Lucas Sequences Golden Ratio, Formulas, and Sequences Let φ be the Golden Ratio: φ = (1 + √5) ÷ 2...