

A347945


To get {a(n)}, start with the nonnegative integers sequence f() and, for each y>=0, shift the f(y) to position f(2y) and reset indices.


0



0, 2, 3, 1, 6, 7, 5, 10, 11, 8, 14, 15, 4, 18, 19, 13, 22, 23, 16, 26, 27, 12, 30, 31, 21, 34, 35, 24, 38, 39, 17, 42, 43, 29, 46, 47, 32, 50, 51, 9, 54, 55, 37, 58, 59, 40, 62, 63, 28, 66, 67, 45, 70, 71, 48, 74, 75, 33, 78, 79, 53, 82, 83, 56
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

To get {a(n)}, we use the working sequences f_x(y), where y is the index and x is both, the xth working sequence and a control variable. x=0,1,2,3,... up to infinity.
f_x(y) = f_(x1)(x) if y = 2x, f_(x1)(y+1) if x <= y < 2x, and s_(x1)(y) otherwise.
Start with the sequence of nonnegative integers
{f(y)} = 0,1,2,3,4,5,6,7,8,9,10,11,12,...
The first index is 0: For f(y=0), nothing is changed, since f(2*0=0), so we still have
{f_0(y)} = 0,1,2,3,4,5,6,7,8,9,10,11,12,...
For x=1: Shift f(1)=1 to f(2*1)=f(2), and all f(1<y<=2) to f(y1): f(2)=2 to f(1), leaving
{f_1(y)} = 0,2,1,3,4,5,6,7,8,9,10,11,12,...
For x=2: Shift f(2)=1 to f(2*2)=f(4), and all f(1<y<=4) to f(y1), leaving
{f_2(y)} = 0,2,3,4,1,5,6,7,8,9,10,11,12,...
Iterating the "cyclic shifting" indefinitely produces {a(n)}.
.
Visualization of the term indexposition shift:
f_1: 0 1 2 3 4 5 6 7 8 9 10 11 12 ...
└+1─^
f_2: 0 2 1 3 4 5 6 7 8 9 10 11 12 ...
└──+2──^
f_3: 0 2 3 4 1 5 6 7 8 9 10 11 12 ...
└───+3────^
f_4: 0 2 3 1 5 6 4 7 8 9 10 11 12 ...
└─────+4─────^
f_5: 0 2 3 1 6 4 7 8 5 9 10 11 12 ...
└───────+5───────^
f_6: 0 2 3 1 6 7 8 5 9 10 4 11 12 ...
.
In the Formula section, formulas (2) and (3) (which build pairs of terms with a certain repeating spacing and difference, unlike formula (1)) give the terms with the single most f(x) to f(2x) shifts.
Some terms f(y) only get shifted to f(y1), decreasing their final index n; other terms f(y) change position to f(2y) multiple times.
The value "t" in formulas (1), (2) and (3) gives the number of f(2y) shifts "s" of the resulting terms: For (1): s = t, for (2),(3): s = t1.
E.g., the terms f(y) for the formulas (2) and (3) with t=1 (e.g., 2,3,6,7,10,11,...) only get shifted to f(y1), e.g., f(y)=14=a(10), decreasing its index n from 14 to 10.
Other terms f(y) for formulas (2) and (3) with t>1 change position to f(2y) one or multiple times; e.g., for formula (2) t=3, k=1: f(y)=28=a(48) increases its position 2 times from its original y=28 up to n=48.
The number of times that the terms f(y) for formula (1) change position to f(2y) is t. E.g., t=5: f(y)=20=a(120) changes positions 5 times, up to n=120.


LINKS



FORMULA

To obtain all terms there are three formulas.
For any t=1,2,3,... and k=0,1,2,3,... constellation:
(1) a((3^t  3)/2) = (2^(t+2) + (1)^(t1)  9)/6.
(2) a(k*3^t + (5*3^(t1)3)/2) = k*2^(t+1) + 2^t + (2^(t+2) + (1)^(t1)  9)/6.
(3) a(k*3^t + (7*3^(t1)3)/2) = k*2^(t+1) + 2^t + (2^(t+3)  (1)^(t1)  9)/6.


EXAMPLE

Formula (1) has no control value "k" and produces small values (terms) for large index numbers n, compared to formulas (2) and (3).
E.g.:
For formula (1) t=5: a(363)=41.
For formula (2) t=1, k=100: a(301)=402.
Formula (1) produces the "Generalized Jacobsthal numbers" as a subsequence "s": s(A029858(t))=A084639(t), and the differences between those terms are the "Jacobsthal numbers" A001045.


PROG

(PARI) shiftv(v, n) = {my(w = v); for (i=1, n1, w[i] = v[i]; ); for (i=n, 2*n1, w[i] = v[i+1]; ); w[2*n] = v[n]; w; }
lista(nn) = {my(v = [1..nn], va); for (n=1, nn\2, va = shiftv(v, n); v = va; ); concat(0, vector(#v\2, k, v[k])); } \\ Michel Marcus, Sep 21 2021
(PARI) a(n) = n++; my(c=1, r); while([n, r]=divrem(n, 3); r==1, c++); n<<(c+1) + (r<<1+1)<<c\3  1; \\ Kevin Ryde, Oct 09 2021


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



