login
A319419
In binary expansion of n, delete one symbol from each run. Set a(n)=-1 if the result is the empty string.
3
-1, -1, -1, 1, 0, -1, 1, 3, 0, 0, -1, 1, 2, 1, 3, 7, 0, 0, 0, 1, 0, -1, 1, 3, 4, 2, 1, 3, 6, 3, 7, 15, 0, 0, 0, 1, 0, 0, 1, 3, 0, 0, -1, 1, 2, 1, 3, 7, 8, 4, 2, 5, 2, 1, 3, 7, 12, 6, 3, 7, 14, 7, 15, 31, 0, 0, 0, 1, 0, 0, 1, 3, 0, 0, 0, 1, 2, 1, 3, 7, 0, 0
OFFSET
0,8
COMMENTS
If the binary expansion of n is 1^b 0^c 1^d 0^e ..., then a(n) is the number whose binary expansion is 1^(b-1) 0^(c-1) 1^(d-1) 0^(e-1) .... Leading 0's are omitted, and if the result is the empty string, here we set a(n) = -1. See A318921 for a version which represents the empty string by 0.
Lenormand refers to this operation as planing ("raboter") the runs (or blocks) of the binary expansion.
A175046 expands the runs in a similar way, and a(A175046(n)) = A001477(n). - Andrew Weimholt, Sep 08 2018 (Comment copied from A318921.)
a(n) = -1 iff n in A000975.
LINKS
Claude Lenormand, Deux transformations sur les mots, Preprint, 5 pages, Nov 17 2003. Apparently unpublished. This is a scanned copy of the version that the author sent to me in 2003.
N. J. A. Sloane, Coordination Sequences, Planing Numbers, and Other Recent Sequences (II), Experimental Mathematics Seminar, Rutgers University, Jan 31 2019, Part I, Part 2, Slides. (Mentions this sequence)
EXAMPLE
n / "planed" string / a(n)
0 e -1 (e = empty string)
1 e -1
10 e -1
11 1 1
100 0 0
101 e -1
110 1 1
111 11 3
1000 00 0
1001 0 0
1010 e -1
1011 1 1
1100 10 2
1101 1 1
1110 11 3
1111 111 7
10000 000 0
...
MAPLE
r:=proc(n) local t1, t2, L, len, i, j, k, b1;
if n <= 2 then return(-1); fi;
b1:=[]; t1:=convert(n, base, 2); L:=nops(t1); p:=1; len:=1;
for i from 2 to L do
t2:=t1[L+1-i];
if (t2=p) and (i<L) then len:=len+1;
else # run ended
if (i = L) and (t2=p) then len:=len+1; fi;
if len>1 then for j from 1 to len-1 do b1:=[op(b1), p]; od: fi;
p:=t2; len:=1;
fi; od;
if nops(b1)=0 then return(-1);
else k:=b1[1];
for i from 2 to nops(b1) do k:=2*k+b1[i]; od;
return(k);
fi;
end;
[seq(r(n), n=0..120)];
PROG
(Python)
from re import split
def A319419(n):
s = ''.join(d[:-1] for d in split('(0+)|(1+)', bin(n)[2:]) if d not in {'', '0', '1', None})
return -1 if s == '' else int(s, 2) # Chai Wah Wu, Sep 24 2018
CROSSREFS
KEYWORD
sign,base,hear
AUTHOR
N. J. A. Sloane, Sep 21 2018
STATUS
approved