login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A378423
a(n) is the number of distinct terms reached by iterating the function f(x) = 2 + A008472(x), starting from x=n.
0
3, 2, 4, 1, 3, 4, 3, 2, 3, 4, 7, 4, 6, 8, 5, 2, 7, 4, 6, 4, 5, 6, 5, 4, 4, 8, 4, 8, 5, 5, 4, 2, 3, 6, 9, 4, 6, 6, 5, 4, 7, 9, 6, 6, 5, 5, 5, 4, 4, 4, 7, 8, 6, 4, 5, 8, 5, 4, 7, 5, 6, 10, 5, 2, 5, 5, 10, 6, 9, 3, 7, 4, 6, 8, 5, 6, 5, 5, 5, 4, 4, 6, 6, 9, 5, 6, 7, 6, 8, 5, 7, 5, 5, 8, 9, 4, 4, 8, 3, 4
OFFSET
1,1
COMMENTS
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 f.
The set A(n) contains either the fixed point 4 or a cyclic component {5,7,9}.
EXAMPLE
For n=33, 33->16->4->4-> ... and 4 is a fixed point, then a(n)= number of distinct terms = 3.
For n=66, 66->18->7->9->5->7 ... and {5,7,9} is a cyclic component, then a(n)= number of distinct terms = 5.
MAPLE
f:= proc(n)
add( d, d= numtheory[factorset](n)):
end proc: f(1) := 0:
g:= proc(n)
2 + f(n)
end proc:
a:= 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(a, [$1..100]);
MATHEMATICA
a[n_] := -1 + Length@ NestWhileList[2 + If[# == 1, 0, Total[FactorInteger[#][[;; , 1]]]] &, n, UnsameQ, All]; Array[a, 100] (* Amiram Eldar, Nov 26 2024 *)
PROG
(Python)
from sympy import factorint
def a(n):
reach = set()
while n not in reach:
reach.add(n)
n = 2 + sum(factorint(n))
return len(reach)
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Nov 26 2024
CROSSREFS
Cf. A008472.
Sequence in context: A377511 A123359 A376070 * A121885 A187760 A122143
KEYWORD
nonn
AUTHOR
Rafik Khalfi, Nov 25 2024
STATUS
approved