cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A359008 Jane Street's infinite sidewalk's greedy walk inverse mapping.

This page as a plain text file.
%I A359008 #18 May 21 2023 10:26:48
%S A359008 0,1,2,5,3,6,9,4,7,15,10,29,13,8,16,27,11,30,49,14,60,25,17,28,47,12,
%T A359008 31,58,50,23,34,61,26,45,18,64,56,48,75,21,32,59,105,51,24,70,35,62,
%U A359008 54,81,46,73,19,65,111,57,103,214,76,22,68,33,244,87,106,52
%N A359008 Jane Street's infinite sidewalk's greedy walk inverse mapping.
%C A359008 For n a nonnegative integer, a(n) is the smallest nonnegative integer i such that A359005(i) == n.
%C A359008 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.)
%C A359008 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.
%D A359008 Inverse mapping of A359005.
%H A359008 Neal Gersh Tolunsky, <a href="/A359008/b359008.txt">Table of n, a(n) for n = 0..10000</a>
%o A359008 (Python)
%o A359008 def a(n: int) -> int:
%o A359008     if n < 0: raise Exception("n must be a nonnegative integer")
%o A359008     i = 0
%o A359008     if n == 0: return i
%o A359008     visited = {0}
%o A359008     slab = 1
%o A359008     while True:
%o A359008         i += 1
%o A359008         if slab == n: return i
%o A359008         visited.add(slab)
%o A359008         label = 1 + (slab >> 1)
%o A359008         if not slab - label in visited:
%o A359008             slab -= label  # jumping backwards
%o A359008         else:
%o A359008             slab += label  # jumping forwards
%o A359008             if slab in visited: raise Exception(f"blocked at slab {slab}")
%Y A359008 Cf. A358838, A359005.
%K A359008 nonn
%O A359008 0,3
%A A359008 _Frederic Ruget_, Dec 11 2022