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.

A057689 Maximal term in trajectory of P under the 'Px+1' map, where P = n-th prime, or -1 if no such term exists.

Original entry on oeis.org

16, 66, 50, 672, 20372, 494, 36918, 1404, 12210, 4248, 5070, 1682, 1850, 2210, 35882, 102720, 94484303672, 30084, 178992, 5330, 246560, 6890, 294253314, 8416400, 515202, 134004, 2810784, 2810883506682183650, 377198408, 320168
Offset: 2

Views

Author

N. J. A. Sloane, Oct 20 2000

Keywords

Comments

See A057684 for definition.

Examples

			For n=3, P=7: trajectory of 7 is 7, 50, 25, 5, 1, 8, 4, 2, 1, 8, 4, 2, 1, 8, 4, 2, 1, ..., which has maximal term 50, cycle length 4 and there are 4 terms before it enters the cycle.
		

Crossrefs

Programs

  • Mathematica
    Px1[p_,n_]:=Catch[For[i=1,iPaolo Xausa, Dec 11 2023 *)
  • Python
    from sympy import prime, primerange
    def a(n):
        P = prime(n)
        x, plst, seen = P, list(primerange(2, P)), set()
        while x > 1 and x not in seen:
            seen.add(x)
            x = next((x//p for p in plst if x%p == 0), P*x+1)
        return max(seen)
    print([a(n) for n in range(2, 32)]) # Michael S. Branicky, Dec 11 2023

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Nov 08 2000