OFFSET
0,2
COMMENTS
It is provable that every nonnegative integer can be written uniquely in the form (k - 2^m)*2^(m-1) - 1, where 1 < 2^m < k odd. Cf. A387016 (with a similar formula), where such uniqueness is proven. Similarly here, a term t must have m = A007814(2t+2), and k follows from that so that the representation is unique.
This allows us to determine the consecutive terms a(n) of this sequence that is a permutation of all integers >= 0 based on A387016 created similarly (see here and there the first and second formulas).
By the expressions k = 2*A030530(n+1) + 1 and m = n - A001855(A030530(n+1)), we obtain an explicit formula for a(n); i.e., dependent only on its index n. Let us also note that k = A386220(a(n-1)+1), by inversion.
Even numbers appear in ascending order at a(A001855(n)) = 2*n; the first term of each k (i.e., with m = 1).
LINKS
Amiram Eldar, Table of n, a(n) for n = 0..11702 (terms corresponding to k < 2500)
FORMULA
EXAMPLE
Initial terms and their k and m begin
n = 0 1 2 3 4 5 6 7 8 9 10 ...
a(n) = 0, 2, 1, 4, 5, 6, 9, 3, 8, 13, 11, ...
k = 3 5 5 7 7 9 9 9 11 11 11
m = 1 1 2 1 2 1 2 3 1 2 3
runs \---/ \---/ \-------/ \-------/
For odd k=7 and m=2, we have 1<2^2<7, so a(n)=(7-2^2)*2^(2-1)-1=5 where n=A001855((7-1)/2)+2-1=3+1=4.
For odd k=9 and m=1, we have 1<2^1<9, so a(n)=(9-2^1)*2^(1-1)-1=6 where n=A001855((9-1)/2)+1-1=5+0=5.
MATHEMATICA
Table[(k-2^m)*2^(m-1)-1, {k, 3, 50, 2}, {m, 1, Log2[k]}] // Flatten (* Amiram Eldar, Aug 21 2025 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Thomas Ordowski, Aug 20 2025
EXTENSIONS
More terms from Michel Marcus, Aug 20 2025
STATUS
approved
