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”).
%I #6 Nov 19 2024 02:25:37
%S 1,2,3,4,5,5,7,11,11,7,11,7,13,20,19,19,17,19,19,20,17,13,23,20,17,34,
%T 20,11,29,17,31,17,34,19,19,17,37,38,35,11,41,19,43,34,11,42,47,11,34,
%U 19,40,17,53,11,35,13,35,31,59,19,61,67,13,19,37,35,67
%N Iterated integer log of n: denote A001414(n) by b(n). a(n) = n if b(n) = n. Otherwise, a(n) = b(n) + b(b(n)) + ... + b^k(n), where k is the smallest integer such that b^k(n) is prime.
%C Can be understood as an exotic way of measuring how far a number is from being prime, since omitting n = 1, 4, |a(n) - n| = 0 if and only if n is prime. Note that A274718(n) = k - 1 when a(n) = b(n) + b(b(n)) + ... + b^k(n). The scatter plot for n >= 10000 shows intriguing regularities.
%e a(24) is computed as follows: 24 = (2^3) * 3, 2 * 3 + 3 = 9. 9 = (3^2), 3 + 3 = 6. 6 = 2 * 3, 2 + 3 = 5. Since 5 is prime, we stop and take the sum: 9 + 6 + 5 = 20.
%o (Python)
%o from sympy import*
%o def a(n):
%o t=0
%o while n not in (1,4) and not isprime(n):
%o n=sum(p*e for p,e in factorint(n).items());t+=n
%o return t or n
%Y Cf. A001414, A274718.
%K nonn,easy,look
%O 1,2
%A _Louis-Simon Cyr_, Oct 29 2024