We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f31ffec commit 91bb091Copy full SHA for 91bb091
1 file changed
archive/t/ti-basic/zeckendorf.8xp.txt
@@ -0,0 +1,47 @@
1
+Input "",Str1
2
+"0123456789"->Str2
3
+length(Str1)->L
4
+L<1->E
5
+0->D
6
+0->V
7
+1->N
8
+1->S
9
+While E=0 and N<=L
10
+ sub(Str1,N,1)->C
11
+ inString(Str2,C)-1->K
12
+ If C="+" or C="-"
13
+ Then
14
+ D>0->E
15
+ If C="-"
16
+ Then 0-S->S
17
+ End
18
+ Else
19
+ K<0->E
20
+ D+1->D
21
+ V*10+K*S->V
22
23
+ N+1->N
24
+End
25
+If E or D<1 or V<0->E Then Disp "Usage: please input a non-negative integer"
26
+Else
27
+ 1->A
28
+ 2->B
29
+ While A<=V
30
+ B+A->B
31
+ B-A->A
32
33
+ {}->l1
34
+ 0->N
35
+ While V>0
36
37
+ B-A->B
38
+ If V>=A Then
39
40
+ A->l1(N)
41
+ V-A->V
42
43
44
45
+If l1 Then
46
+ Disp l1
47
0 commit comments