login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A338807 Numbers k such that the process starting at (k, 0) mapping (k, t) to (k+1, t+k) if t = 0 (mod k), and (k-1, t+k) otherwise, eventually reaches (1, T) for some T. 0

%I #23 Dec 02 2020 08:42:14

%S 1,2,8,9,11,14,18,20,23,32,35,38,40,47,49,50,53,56,57,58,59,62,67,71,

%T 73,74,77,89,91,92,95,98,101,104,106,114,116,128,134,135,137,140,148,

%U 149,152,155,156,158,159,162,164,169,172,173,185,188,191,194,197

%N Numbers k such that the process starting at (k, 0) mapping (k, t) to (k+1, t+k) if t = 0 (mod k), and (k-1, t+k) otherwise, eventually reaches (1, T) for some T.

%C At each step, let the state of the process be (i,t), i_max the greatest i seen so far and i_min > 1 the least i seen so far. Consider the triples (i,j,t%j) for 2 <= j <= i_max, where i_max is the largest i seen so far. If all of those triples have been seen in previous steps, then the next step will not produce a new triple either, so the process will never reach i=1.

%e For k = 8, the process stops at T = 57: (8,0), (9,8), (8,17), (7,25), (6,32), (5,38), (4,43), (3,47), (2,50), (3,52), (2,55), (1,57).

%e For k = 4, the process never stops: (4,0), (5,4), (4,9), (3,13), (2,16), (3,18), (4,21), ...

%o (Python)

%o def isok(n):

%o t = 0

%o seen = set()

%o maxn = n

%o steps = 0

%o while n>1:

%o maxn = max(maxn,n)

%o tuples = set((n,m,t%m) for m in range(2,maxn+1))

%o if tuples <= seen:

%o break

%o seen = seen.union(tuples)

%o t += n

%o if t%n==0:

%o n += 1

%o else:

%o n -= 1

%o return n==1

%K easy,nonn

%O 1,2

%A _Christian Perfect_, Nov 10 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 16:38 EDT 2024. Contains 371794 sequences. (Running on oeis4.)