OFFSET
1,7
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
Jeroen van der Meer, C implementation
EXAMPLE
If n = 6 then there is a single cyclic orbit of size 2, namely {2, 5}.
If n = 7 then there are two cyclic orbits, both of size 1, namely {3} and {5}.
PROG
(Python)
def o(n):
orbits = set()
for k in range(n):
x, traj = k, []
while x not in traj:
traj.append(x)
x = (x**2 + 1) % n
orbits.add(tuple(sorted(traj[traj.index(x):])))
return orbits
print([len(o(n)) for n in range(1, 100)]) # Andrey Zabolotskiy, Apr 12 2022
(Python)
def A352635(n):
cset, iset = set(), set()
for i in range(n):
if i not in iset:
j, jset, jlist = i, set(), []
while j not in jset:
jset.add(j)
jlist.append(j)
iset.add(j)
j = (j**2+1) % n
cset.add(min(jlist[jlist.index(j):]))
return len(cset) # Chai Wah Wu, Apr 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Jeroen van der Meer, Apr 12 2022
STATUS
approved