login
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
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
Cf. A252867.
Sequence in context: A157890 A329932 A359858 * A198821 A171897 A105029
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, May 01 2024
STATUS
approved