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.

This page as a plain text file.
%I A340801 #15 Jun 24 2022 22:42:25
%S A340801 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,
%T A340801 13,26,14,839,15,959,16,32,17,34,18,1367,19,38,20,1679,21,1847,22,44,
%U A340801 23,2207,24,48,25,50,26,2807,27,54,28,56,29,3479,30,3719,31,62
%N 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.
%C A340801 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.
%C A340801 Conjecture 2: An integer n eventually reaches 1 when map f is applied to n repeatedly.
%F A340801 a(2*k+1) = 2*a(2*k) if 2*k+1 is not a prime.
%F A340801 a(2*k+2) = a(2*k) + 1, where k >= 1.
%o A340801 (Python)
%o A340801 from sympy import isprime
%o A340801 for n in range(1, 101):
%o A340801     if isprime(n) == 1 and n != 2: a = n*n - 2
%o A340801     elif n%2 == 0: a = n/2
%o A340801     else: a = n - 1
%o A340801     print(a)
%o A340801 (PARI) a(n) = if (n%2, if (isprime(n), n^2-2, n-1), n/2); \\ _Michel Marcus_, Jan 22 2021
%Y A340801 Cf. A339991, A340008, A340419, A006577.
%K A340801 nonn
%O A340801 1,3
%A A340801 _Ya-Ping Lu_, Jan 21 2021