login
A376070
a(n) is the number of distinct terms reached by iterating the function x->2+A075860(x), starting from x=n, with n>0.
1
3, 2, 4, 1, 3, 4, 3, 2, 3, 4, 4, 4, 3, 4, 2, 2, 6, 4, 5, 4, 4, 3, 5, 4, 4, 2, 4, 4, 6, 4, 5, 2, 4, 5, 4, 4, 3, 4, 2, 4, 4, 4, 3, 3, 2, 4, 5, 4, 4, 4, 4, 2, 3, 4, 2, 4, 3, 5, 6, 4, 5, 4, 4, 2, 4, 2, 3, 5, 2, 4, 4, 4, 3, 2, 2, 4, 4, 4, 5, 4, 4, 3, 4, 4, 3, 2, 2, 3, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 4, 4
OFFSET
1,1
COMMENTS
The sequence has another definition: a(n)= The number of distinct elements in the set A(n)={f^{k}(n);k>=0}, where f^{k} is the k-th iteration of the function f defined by f(n)=2+A075860(n), f^{0}(n)=n and n>0.
For all n>0, the set A(n) contains either the fixed point 4 or a cyclic component {5,7,9}.
For all n>1 and h in A(n)\{n}, h-2 is a prime number.
a(n)=1 if and only if n=4.
If (p,p+2) is a twin prime pair with p>7, then a(p+2)=a(p)-1.
EXAMPLE
For n=3, 3->5->7->9->5->7->9-> ... and {5,7,9} is a cyclic component, then a(n)=number of distinct terms = 4.
For n=66, 66->4->4->4-> ... and 4 is a fixed point, then a(n)= number of distinct terms = 2.
For n=25, 25->7->9->5->7->9->5->7->9->... and {5,7,9} is a cyclic component, then a(n)=number of distinct terms = 4.
MAPLE
f := proc(n) option remember:
if isprime(n) then
n
else
procname(convert(numtheory:-factorset(n), `+`))
end if
end proc:
f(1) := 0:
g := proc(n)
2 + f(n)
end proc:
A376070 := proc(n)
local k, result:
k := 1:
result := n:
while not (result = 4 or result = 5 or result = 7 or result = 9) do
result := g(result):
k := k + 1:
end do:
if result = 5 or result = 7 or result = 9 then
return k + 2;
else
return k:
end if
end proc:
map(A376070, [$1..200]);
PROG
(Python)
from sympy import primefactors
def a(n, pn):
if n == pn:
return n
else:
return a(sum(primefactors(n)), n)
def A376070(n):
k = 1
result = n
while result not in {4, 5, 7, 9}:
result = 2 + a(result, None)
k += 1
if result in {5, 7, 9}:
return k + 2
else:
return k
print([A376070(i) for i in range(1, 200)])
CROSSREFS
Cf. A075860.
Sequence in context: A226377 A140430 A123359 * A121885 A187760 A122143
KEYWORD
nonn
AUTHOR
Rafik Khalfi, Sep 08 2024
STATUS
approved