HP Forums

Full Version: (42S) Champernowne Sequence (OEIS A030190)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The Champernowne sequence

https://oeis.org/A030190

is the natural number sequence

https://en.wikipedia.org/wiki/ISO_80000-2

concatenated in binary & split into single digits:

0,1,1,0,1,1,1,0,0.........

For integer input N the programme returns the Nth element of the series starting from index zero.

The programme CHAM uses 2 sub-programmes, for CEIL see

http://www.hpmuseum.org/forum/thread-7691.html

and LAM w see

http://www.hpmuseum.org/forum/thread-7692.html

Code:

0.    { 100-Byte Prgm }
1.    LBL “CHAM”
2.    1
3.    X<Y?
4.    GTO 00
5.    R↓
6.    RTN
7.    LBL 00
8.    R↓
9.    STO "N"
10.    1
11.    -
12.    2
13.    LN
14.    2
15.    /
16.    *
17.    XEQ "LAM w"
18.    2
19.    LN
20.    /
21.    1
22.    +
23.    XEQ "CEIL"
24.    2
25.    RCL ST Y
26.    Y^X
27.    ENTER
28.    RCL+ "N"
29.    2
30.    -
31.    RCL ST Z
32.    MOD
33.    RCL ST Z
34.    -
35.    1
36.    +
37.    2
38.    X<>Y
39.    Y^X
40.    STO ST T
41.    R↓
42.    RCL+ "N"
43.    1
44.    -
45.    X<>Y
46.    /
47.    1
48.    -
49.    XEQ "CEIL"
50.    *
51.    IP
52.    2
53.    MOD
54.    END
Reference URL's