|
|
A339597
|
|
When 2*n+1 first appears in A086799.
|
|
5
|
|
|
1, 2, 5, 4, 9, 10, 13, 8, 17, 18, 21, 20, 25, 26, 29, 16, 33, 34, 37, 36, 41, 42, 45, 40, 49, 50, 53, 52, 57, 58, 61, 32, 65, 66, 69, 68, 73, 74, 77, 72, 81, 82, 85, 84, 89, 90, 93, 80, 97, 98, 101, 100, 105, 106, 109, 104, 113, 114, 117, 116, 121, 122, 125, 64, 129, 130, 133, 132, 137
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
FORMULA
|
a(n) = 2*(n+1) - A006519(n+1) = n+1 with a 0 bit inserted above its least significant 1-bit. - Kevin Ryde, Mar 29 2021
|
|
MAPLE
|
N := 127: # for a(0) to a(N)
V := Array(0..N): count := 0:
for i from 1 while count < N+1 do
with(MmaTranslator[Mma]):
f(i) := BitOr(i, i-1);
v := (f(i)-1)/2;
if v <= N and V[v] = 0 then count := count+1; V[v] := i fi
od:
|
|
PROG
|
(PARI) f(n) = bitor(n, n-1); \\ A086799
a(n) = my(k=1); while (f(k) != 2*n+1, k++); k; \\ Michel Marcus, Jan 07 2021
(PARI) a(n) = n++; n<<1 - 1<<valuation(n, 2); \\ Kevin Ryde, Mar 29 2021
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|