[seqfan] Look left and say (binary version)

Jeremy Gardiner jeremy.gardiner at btinternet.com
Mon Nov 18 10:49:10 CET 2019


Dear seqfans,

Inspired by the "Look left and say" sequence I experimented with a binary
version of the sequence, shown below without separating commas.

I noticed the intermediate values used to generate the sequences are
interesting, these appear first.

Starting at 0:

>run "/sequences/leftbits.bas"
1,2,4,7,8,12,15,16,21,24,28,31,32,38,42,46,49,53,56,60,
0101001000111010000110001111010000010101011000011100011111010000001001100101
0100101110011000101101010111000011110000

The intermediate values here give a known sequence A233271:

a(0)=0; thereafter a(n+1) = a(n) + 1 + number of 0's in binary
representation of a(n), counted with A080791.

Starting at 1:

>run "/sequences/leftbits.bas"
1,3,6,9,12,15,20,23,28,32,34,37,41,45,50,54,59,65,68,71,
1111111101100111100111111101001101111111001100000110001011001011101001110110
11110010111011011110111100000111000100110001111

The intermediate values here give a new sequence:

a(0)=0; thereafter a(n+1) = a(n) + 1 + number of 1's in binary
representation of a(n).

This does not appear to be in the OEIS.

My program is below.

Regards,
Jeremy Gardiner

rem Number of ones (or zeros) to my left
rem Cf. 'look left and say' sequence
rem Chipmunk BASIC v3.6.5(b3)
rem written 17/11/19 by Jeremy C. Gardiner
rem vars b$,s$,i,n,s
rem Initial term 0 or 1
b$="1"
s$=b$
for n=1 to 30
rem count ones or zeros in string
s=0
for i=1 to len(s$)
if mid$(s$,i,1)=b$ then s=s+1
next i
rem print intermediate values
print str$(s)+",";
rem append binary count plus b$ to string
s$=s$+bin$(s)+b$
next n
print
print s$
end





More information about the SeqFan mailing list