First Forward into Logo 11: Sequences
This part introduces the use of Logo for number work. Learn how to use Logo to generate sequences of numbers.
Problem
First Forward Into Logo
Previous: FF10
Consider the following procedure which uses two variables:
(Warning - you may have to press HALT to stop this procedure.)
TO LOP :X :Y
PR :X
WAIT 120
LOP :Y :X + :Y
END
What do you think is happening this time?
Try 'chasing' through the procedure the values: x = 1 and y = 1.
No longer surprised!
Why do you think it goes on and on...?
Yes it keeps starting itself again, but with different variables,
moving on in the sequence by adding the last two variables.
Why not experiment further changing the fourth line?
For example:
LOP :Y :X +:Y*2
LOP :Y :X - :Y*2
LOP :Y :X * 2
Any surprises?
LOP :Y * 2 :X + :Y
Etc. Etc. Etc....
|
1
1
3
5
11
21
43
85
171
341
683
1365
2731
5461
10923
21845
43691
87381
174763
349525
699051
1398101
2796203
5592405
11184811
22369621
44739243
89478485
178956971
357913941
|
Next: FF12