|
|
A372060
|
|
a(n) = smallest k such that A252867(k) = n, or -1 if no such k exists.
|
|
3
|
|
|
0, 1, 2, 6, 5, 3, 9, 13, 12, 10, 4, 18, 7, 23, 16, 25, 22, 8, 11, 20, 28, 35, 32, 41, 14, 38, 43, 59, 30, 56, 53, 75, 17, 15, 27, 29, 19, 66, 39, 70, 21, 33, 36, 85, 49, 68, 51, 95, 24, 64, 45, 79, 47, 104, 98, 110, 62, 93, 73, 115, 106, 113, 108, 154, 42, 31, 34, 48, 37, 44
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Both A252867 and this sequence are conjectured to be permutations of the nonnegative integers, in which case they are inverses of each other.
|
|
LINKS
|
|
|
MAPLE
|
local i;
for i from 0 do
return i ;
end if;
end do:
end proc:
for n from 0 do
printf("%d %d\n", n, A372060(n)) ; # b-style output
|
|
MATHEMATICA
|
kmax = 1000;
b[n_] := b[n] = Module[{k}, If[n < 3, n, For[k = 3, True, k++, If[FreeQ[Array[b, n - 1], k], If[BitAnd[k, b[n - 2]] >= 1 && BitAnd[k, b[n - 1]] == 0, Return[k]]]]]];
a[n_] := Module[{k}, For[k = 0, k <= kmax, k++, If[b[k] == n, Return[k]]]] /. Null -> -1;
|
|
PROG
|
(Python)
if n<3: return n
l1, l2, s, b, k = 2, 1, 3, set(), 3
while True:
for i in count(s):
if not (i in b or i & l1) and i & l2:
if i == n: return k
k += 1
l2, l1 = l1, i
b.add(i)
while s in b:
b.remove(s)
s += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,changed
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|