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.

Previous Showing 11-11 of 11 results.

A352635 Number of cyclic orbits of the function f(x) = x^2 + 1 on Z/nZ.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 2, 1, 2, 2, 1, 1, 1, 4, 3, 2, 1, 1, 3, 1, 1, 2, 2, 1, 3, 2, 3, 1, 1, 2, 3, 2, 3, 2, 2, 1, 6, 1, 1, 4, 1, 3, 1, 2, 2, 2, 1, 1, 3, 3, 2, 1, 3, 2, 4, 2, 1, 2, 3, 1, 3, 4, 1, 2, 2, 4, 5, 1, 3, 1, 1, 2, 3, 4, 1, 2, 3, 3, 6, 2, 3, 3, 2, 1, 4, 10
Offset: 1

Views

Author

Jeroen van der Meer, Apr 12 2022

Keywords

Examples

			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}.
		

Crossrefs

Related to A000374 and A023153.

Programs

  • 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
Previous Showing 11-11 of 11 results.