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.

A340801 a(n) is the image of n under the map f defined as f(n) = n^2 - 2 if n is an odd prime, f(n) = n/2 if n is even, and f(n) = n - 1 otherwise.

Original entry on oeis.org

0, 1, 7, 2, 23, 3, 47, 4, 8, 5, 119, 6, 167, 7, 14, 8, 287, 9, 359, 10, 20, 11, 527, 12, 24, 13, 26, 14, 839, 15, 959, 16, 32, 17, 34, 18, 1367, 19, 38, 20, 1679, 21, 1847, 22, 44, 23, 2207, 24, 48, 25, 50, 26, 2807, 27, 54, 28, 56, 29, 3479, 30, 3719, 31, 62
Offset: 1

Views

Author

Ya-Ping Lu, Jan 21 2021

Keywords

Comments

Conjecture 1: Iterating map f on an integer n (n > 1) results in a different integer, or f^i(n) != f^j(n) if i != j, where f^i(n) and f^j(n) are the i-th and j-th iterations of map f on n respectively.
Conjecture 2: An integer n eventually reaches 1 when map f is applied to n repeatedly.

Crossrefs

Programs

  • PARI
    a(n) = if (n%2, if (isprime(n), n^2-2, n-1), n/2); \\ Michel Marcus, Jan 22 2021
  • Python
    from sympy import isprime
    for n in range(1, 101):
        if isprime(n) == 1 and n != 2: a = n*n - 2
        elif n%2 == 0: a = n/2
        else: a = n - 1
        print(a)
    

Formula

a(2*k+1) = 2*a(2*k) if 2*k+1 is not a prime.
a(2*k+2) = a(2*k) + 1, where k >= 1.