login
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.
1
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,3
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.
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.
PROG
(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)
(PARI) a(n) = if (n%2, if (isprime(n), n^2-2, n-1), n/2); \\ Michel Marcus, Jan 22 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, Jan 21 2021
STATUS
approved