login
A386386
Permutation of the nonnegative integers formed by their unique representation (k - 2^m)*2^(m-1) - 1, where 1 < 2^m < k odd, sorted first by k then by m.
3
0, 2, 1, 4, 5, 6, 9, 3, 8, 13, 11, 10, 17, 19, 12, 21, 27, 14, 25, 35, 7, 16, 29, 43, 23, 18, 33, 51, 39, 20, 37, 59, 55, 22, 41, 67, 71, 24, 45, 75, 87, 26, 49, 83, 103, 28, 53, 91, 119, 30, 57, 99, 135, 15, 32, 61, 107, 151, 47, 34, 65, 115, 167, 79, 36, 69, 123, 183, 111
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).
FORMULA
a(n) = (A387016(n+1) - 1)/2 - 1.
a(n) = (k-2^m)*2^(m-1) - 1 = k*2^(m-1)-2^(2m-1)-1 where n = A001855((k-1)/2) + m - 1 with 1 < 2^m < k odd.
a(n) = A089654(n+1)*(2*A030530(n+1) - A089654(n+1) + 1)/2 - 1.
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
Cf. A001477, A001855, A007814 (2-adic valuation), A030530, A089654, A386220, A387016.
Sequence in context: A261608 A351250 A351253 * A110332 A052947 A159287
KEYWORD
nonn,look
AUTHOR
Thomas Ordowski, Aug 20 2025
EXTENSIONS
More terms from Michel Marcus, Aug 20 2025
STATUS
approved