OFFSET
0,3
COMMENTS
For n a nonnegative integer, a(n) is the smallest nonnegative integer i such that A359005(i) == n.
In fact, if a(n) exists, it is actually the unique nonnegative integer i such that A359005(i) == n. ({A359005(n)} is demonstrably an injective mapping from the nonnegative integers onto themselves.)
It is conjectured that a(n) exists for all nonnegative n. This has been verified true with a computer for all n < 7884654. This would make {a(n)} a one-to-one mapping from the nonnegative integers onto themselves.
REFERENCES
Inverse mapping of A359005.
LINKS
Neal Gersh Tolunsky, Table of n, a(n) for n = 0..10000
PROG
(Python)
def a(n: int) -> int:
if n < 0: raise Exception("n must be a nonnegative integer")
i = 0
if n == 0: return i
visited = {0}
slab = 1
while True:
i += 1
if slab == n: return i
visited.add(slab)
label = 1 + (slab >> 1)
if not slab - label in visited:
slab -= label # jumping backwards
else:
slab += label # jumping forwards
if slab in visited: raise Exception(f"blocked at slab {slab}")
CROSSREFS
KEYWORD
nonn
AUTHOR
Frederic Ruget, Dec 11 2022
STATUS
approved