The following BASIC program will tell you whether or not the number you have entered is in the Fibonacci number sequence, printing 1 for true and zero for false. It should allow you to work out the first 50 or so Fibanacci numbers in the sequence.

Tested with normal ROM and ZX81 ROMx2 on an emulated unexpanded machine with EightyOne.

Code: Select all

```
1 INPUT A$
2 LET A=SGN PI
3 LET B=A
4 LET F=VAL A$
5 FOR I=NOT PI TO CODE "L"
6 LET C=A+B
7 LET A=B
8 LET B=C
9 IF B>=F THEN GOTO CODE "£"
10 NEXT I
12 PRINT STR$(B=F OR F<=SGN PI) AND F>=NOT PI;"0" AND F<NOT PI
```

Code: Select all

```
1 INPUT F
2 CLS
3 LET A=1
4 LET B=A
5 FOR I=0 TO 23
6 LET C=B+A
7 LET A=B
8 LET B=C
9 IF B>F OR B=F THEN GO TO 11
10 NEXT I
11 IF (B=F OR F=0 OR F=1) THEN GO TO 14
12 PRINT " NOT FIBONACCI"
13 STOP
14 PRINT "FIBONACCI"
```

Shaun.