OFFSET
0,2
COMMENTS
The 5x+1 problem is as follows: start with any number n. If gcd(n,6)>1, divide it by gcd(n,6), otherwise multiply it by 5 and add 1. Do we always reach 1? This is an unsolved problem. It is conjectured that the answer is yes.
LINKS
Winston de Greef, Table of n, a(n) for n = 0..9999
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,2,0,0,0,0,0,-1).
FORMULA
a(n) = 2*a(n-6) - a(n-12). - Wesley Ivan Hurt, Oct 20 2022
Sum_{k=1..n} a(k) ~ (23/24)*n^2. - Amiram Eldar, Oct 07 2023
MATHEMATICA
f[n_]:=If[GCD[n, 6]>1, n/GCD[n, 6], 5*n+1]; Table[f[n], {n, 0, 100}]
PROG
(PARI) a(n) = my(g = gcd(n, 6)); if (g>1, n/g, 5*n+1); \\ Michel Marcus, Dec 09 2021
(Python)
from math import gcd
def A350034(n): return n//g if (g:=gcd(n, 6)) > 1 else 5*n+1 # Chai Wah Wu, Dec 29 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
José María Grau Ribas, Dec 09 2021
STATUS
approved