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
Michael S. Branicky, Table of n, a(n) for n = 0..100000 (terms 0..9999 from N. J. A. Sloane)
MAPLE
A372060 := proc(n)
local i;
for i from 0 do
if A252867(i) = n then
return i ;
end if;
end do:
end proc:
for n from 0 do
printf("%d %d\n", n, A372060(n)) ; # b-style output
end do: # R. J. Mathar, May 02 2024
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;
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 10 2024 *)
PROG
(Python)
def A372060(n):
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
break # Chai Wah Wu, May 02 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 01 2024
STATUS
approved