OFFSET
1,15
COMMENTS
FORMULA
This is an example of a class of sequences defined by the following recurrence.
We first choose a sequence G = [G(0), G(1), G(2), G(3), ...], which are the terms that will appear at the ends of the blocks: a(2^k-1) = G(k-1), and we also choose a parameter m (the "multiplier"). Then the recurrence (this defines a(1), a(2), a(3), ...) is:
a(2^k-2^r)=G(k-r-1) if 0 <= r <= k-1, a(2^k-2^r+j)=m*a(j)*G(k-r-1) if 2 <= r <= k-1, 1 <= j < 2^r-1.
To help apply the recurrence, here are the values of k,r,j for the first few values of n (if n=2^k-2^r we set j=0, although it is not used):
n: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
k: 1 2 2 3 3 3 3 4 4 4 4 4 4 4 4
r: 0 1 0 2 2 1 0 3 3 3 3 2 2 1 0
j: 0 0 0 0 1 0 0 0 1 2 3 0 1 0 0
--------------------------------------------------
n: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
k: 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
r: 4 4 4 4 4 4 4 4 3 3 3 3 2 2 1 0
j: 0 1 2 3 4 5 6 7 0 1 2 3 0 1 0 0
--------------------------------------------------
In the present example G(n) = wt(n) and m=1.
EXAMPLE
May be arranged into blocks of lengths 1,2,4,8,...:
0,
0, 1,
0, 0, 1, 1,
0, 0, 0, 0, 1, 0, 1, 2,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 2, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 2, 0, 1, 2,
...
MAPLE
Maple code for this sequence:
wt := proc(n) local w, m, i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end:
G:=[seq(wt(n), n=0..30)];
m:=1;
f:=proc(n) option remember; global m, G; local k, r, j, np;
k:=1+floor(log[2](n)); np:=2^k-n;
if np=1 then r:=0; j:=0; else r:=1+floor(log[2](np-1)); j:=2^r-np; fi;
if j=0 then G[k-r]; else m*G[k-r]*f(j); fi;
end;
[seq(f(n), n=1..120)];
# Maple code for the general recurrence:
G:=[seq(wt(n), n=0..30)]; # replace this by a list G=[G(0), G(1), G(2), ...], remembering that you have to tell Maple G[1] to get G(0), G[2] to get G(1), etc.
m:=1; # replace this by the correct multiplier
f:=proc(n) option remember; global m, G; local k, r, j, np;
k:=1+floor(log[2](n)); np:=2^k-n;
if np=1 then r:=0; j:=0; else r:=1+floor(log[2](np-1)); j:=2^r-np; fi;
if j=0 then G[k-r-1+1]; else m*G[k-r-1+1]*f(j); fi;
end;
[seq(f(n), n=1..120)];
# If G(n) = wt(n) and m=1 we get the present sequence
# If G(n) = n (n>=0) and m=1 we get A245536
# If G(n) = n+1 (n>=0) and m=1 we get A038374
# If G(n) = (n+1)(n+2)/2 (n>=0) and m=1 we get A245541
# If G(n) = (n+1)(n+2)/2 (n>=0) and m=2 we get A245547
# If G(n) = 2^n (n>=0) and m=2 we get A048896
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
N. J. A. Sloane, Jul 25 2014
STATUS
approved