HP Forums

Full Version: (35S) Golomb's Sequence
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Golomb's sequence: 1, 2, 2, 3, 3, 4, 4 ... consists of elements indicating the number of occurences of its index in the list, index commencing at 1.

The programme gives exact correct integers for indices to 27,981,938,579.

1 LBL G
2 SF 10
3 27981938579
4 x>=y?
5 GTO G008
6 APPROXIMATE
7 PSE
8 R↓
9 FIX 0
10 CF 10
11 STO A
12 1►B►C►D►E
13 -
14 RCL B
15 1
16 RCL+ E
17 STO E
18 0.61832
19 y^x
20 1.2
21 *
22 RND
23 STO D
24 1
25 +
26 0.5
27 *
28 +
29 RCL D
30 STO+ B
31 RCL* E
32 STO+ C
33 *
34 -
35 x>0?
36 GTO G014
37 RCL D
38 STO- B
39 RCL* E
40 STO- C
41 R↑
42 ENTER
43 ENTER
44 1
45 RCL+ B
46 STO B
47 RCL E
48 STO+ C
49 *
50 -
51 x>0?
52 GTO G042
53 R↓
54 RCL+ B
55 1
56 -
57 RCL B
58 INT÷
59 RCL+ C
60 RCL- E
61 ALL
62 RTN

Improvements & alternative methods welcome.
Reference URL's