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.

A029908 Starting with n, repeatedly sum prime factors (with multiplicity) until reaching 0 or a fixed point. Then a(n) is the fixed point (or 0).

This page as a plain text file.
%I A029908 #49 Feb 16 2025 08:32:35
%S A029908 0,2,3,4,5,5,7,5,5,7,11,7,13,5,5,5,17,5,19,5,7,13,23,5,7,5,5,11,29,7,
%T A029908 31,7,5,19,7,7,37,7,5,11,41,7,43,5,11,7,47,11,5,7,5,17,53,11,5,13,13,
%U A029908 31,59,7,61,5,13,7,5,5,67,7,5,5,71,7,73,5,13,23,5,5,79,13,7,43,83,5,13
%N A029908 Starting with n, repeatedly sum prime factors (with multiplicity) until reaching 0 or a fixed point. Then a(n) is the fixed point (or 0).
%C A029908 That is, the sopfr function (see A001414) applied repeatedly until reaching 0 or a fixed point.
%C A029908 For n > 1, the sequence reaches a fixed point which is either 4 or a prime.
%C A029908 A002217(n) is number of terms in sequence from n to a(n). - _Reinhard Zumkeller_, Apr 08 2003
%C A029908 Because sopfr(n) <= n (with equality at 4 and the primes), the first appearance of all primes is in the natural order: 2,3,5,7,11,... . - _Zak Seidov_, Mar 14 2011
%C A029908 The terms 0, 2, 3 and 4 occur exactly once, because no number > 5 can have factors that sum to be < 5, and therefore can never enter a trajectory that will drop below 5. - _Christian N. K. Anderson_, May 19 2013
%C A029908 For all primes p, where p is contained in A001359, then a(p^2) = p + 2. (A006512). Proof: p^2 has prime factors (p, p). This sums to 2p. 2p has factors (2, p). This sums to p + 2. Since p was the lesser of a twin prime, then p + 2 is the greater of a twin prime. - _Ryan Bresler_, Nov 04 2021
%H A029908 Christian N. K. Anderson, <a href="/A029908/b029908.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from T. D. Noe)
%H A029908 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/SumofPrimeFactors.html">Sum of Prime Factors</a>.
%e A029908 20 -> 2+2+5 = 9 -> 3+3 = 6 -> 2+3 = 5, so a(20)=5.
%p A029908 f:= proc(n) option remember;
%p A029908 if isprime(n) then n
%p A029908 else `procname`(add(x[1]*x[2], x = ifactors(n)[2]))
%p A029908 fi
%p A029908 end proc:
%p A029908 f(1):= 0: f(4):= 4:
%p A029908 map(f, [$1..100]); # _Robert Israel_, Apr 27 2015
%t A029908 ffi[x_] := Flatten[FactorInteger[x]] lf[x_] := Length[FactorInteger[x]] ba[x_] := Table[Part[ffi[x], 2*w-1], {w, 1, lf[x]}] ep[x_] := Table[Part[ffi[x], 2*w], {w, 1, lf[x]}] slog[x_] := slog[x_] := Apply[Plus, ba[x]*ep[x]] Table[FixedPoint[slog, w], {w, 1, 128}]
%t A029908 f[n_] := Plus @@ Flatten[ Table[ #[[1]], {#[[2]]}] & /@ FactorInteger@n]; Array[ FixedPoint[f, # ] &, 87] (* _Robert G. Wilson v_, Jan 18 2006 *)
%t A029908 fz[n_]:=Plus@@(#[[1]]*#[[2]]&/@FactorInteger@n); Array[FixedPoint[fz,#]&,1000] (* _Zak Seidov_, Mar 14 2011 *)
%o A029908 (Python)
%o A029908 from sympy import factorint
%o A029908 def a(n, pn):
%o A029908     if n == pn:
%o A029908         return n
%o A029908     else:
%o A029908         return a(sum(p*e for p, e in factorint(n).items()), n)
%o A029908 print([a(i, None) for i in range(1, 100)]) # _Gleb Ivanov_, Nov 05 2021
%Y A029908 Cf. A001414 (sum of prime factors of n).
%Y A029908 Cf. A081758, A002217, A075860.
%Y A029908 Cf. A001414, A056239, A008475, A082081, A082083.
%K A029908 nonn
%O A029908 1,2
%A A029908 _Dann Toliver_