|
(49G) Moser de Bruijn Sequence, OEIS A000695 +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (https://www.hpmuseum.org/forum/forum-10.html) +--- Forum: General Software Library (https://www.hpmuseum.org/forum/forum-13.html) +--- Thread: (49G) Moser de Bruijn Sequence, OEIS A000695 (/thread-5040.html) |
(49G) Moser de Bruijn Sequence, OEIS A000695 - Gerald H - 2015-10-30 12:36 For integer input N the programme returns the Nth element of the sequence http://oeis.org/A000695 ie the binary base representation of N read as a quaternary base number. Code: ::RE: (49G) Moser de Bruijn Sequence, OEIS A000695 - Thomas Klemm - 2025-10-19 22:27 This program is for the HP-42S: Code: 00 { 26-Byte Prgm }But it can also be used with most other models. Examples 13 R/S 81 44 R/S 1104 References To use these program set: 4 STO 1 2 STO 2 RE: (49G) Moser de Bruijn Sequence, OEIS A000695 - John Keith - 2025-10-22 08:21 Ah, one of my favorite sequences! It has a simple fractal structure: if k appears in the sequence, so do 4k and 4k+1. This leads to a fast and simple program which, given n on the stack, returns a list of the first 2^n terms. For 48G and later (replace NIP with SWAP DROP for the 48).Code: \<< 1 { 0 1 } ROT 2 SWAP |