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.

A378423 a(n) is the number of distinct terms reached by iterating the function f(x) = 2 + A008472(x), starting from x=n.

This page as a plain text file.
%I A378423 #12 Dec 12 2024 23:16:25
%S A378423 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,
%T A378423 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,
%U A378423 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
%N A378423 a(n) is the number of distinct terms reached by iterating the function f(x) = 2 + A008472(x), starting from x=n.
%C A378423 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.
%C A378423 The set A(n) contains either the fixed point 4 or a cyclic component {5,7,9}.
%e A378423 For n=33, 33->16->4->4-> ... and 4 is a fixed point, then a(n)= number of distinct terms = 3.
%e A378423 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.
%p A378423 f:= proc(n)
%p A378423 add( d, d= numtheory[factorset](n)):
%p A378423 end proc: f(1) := 0:
%p A378423 g:= proc(n)
%p A378423    2 + f(n)
%p A378423 end proc:
%p A378423  a:= proc(n)
%p A378423  local k, result:
%p A378423  k := 1:
%p A378423 result := n:
%p A378423 while not (result = 4 or result = 5 or result = 7 or result = 9) do
%p A378423 result := g(result):
%p A378423 k := k + 1:
%p A378423 end do:
%p A378423 if result = 5 or result = 7 or result = 9 then
%p A378423 return k + 2;
%p A378423 else
%p A378423 return k:
%p A378423 end if
%p A378423 end proc:
%p A378423 map(a, [$1..100]);
%t A378423 a[n_] := -1 + Length@ NestWhileList[2 + If[# == 1, 0, Total[FactorInteger[#][[;; , 1]]]] &, n, UnsameQ, All]; Array[a, 100] (* _Amiram Eldar_, Nov 26 2024 *)
%o A378423 (Python)
%o A378423 from sympy import factorint
%o A378423 def a(n):
%o A378423     reach = set()
%o A378423     while n not in reach:
%o A378423         reach.add(n)
%o A378423         n = 2 + sum(factorint(n))
%o A378423     return len(reach)
%o A378423 print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Nov 26 2024
%Y A378423 Cf. A008472.
%K A378423 nonn
%O A378423 1,1
%A A378423 _Rafik Khalfi_, Nov 25 2024