A088685 Records for the sum-of-primes function sopfr(n) if sopfr(prime) is taken to be 0.
0, 4, 5, 6, 7, 9, 10, 13, 15, 19, 21, 25, 31, 33, 39, 43, 45, 49, 55, 61, 63, 69, 73, 75, 81, 85, 91, 99, 103, 105, 109, 111, 115, 129, 133, 139, 141, 151, 153, 159, 165, 169, 175, 181, 183, 193, 195, 199, 201, 213, 225, 229, 231, 235, 241, 243, 253, 259, 265, 271
Offset: 1
Keywords
Links
- Robert Price, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Sum of Prime Factors
Programs
-
Mathematica
Union@ FoldList[Max, Table[Total@ Flatten@ Map[ConstantArray[#1, #2] /. 1 -> 0 & @@ # &, FactorInteger@ n] - n Boole[PrimeQ@ n], {n, 540}]] (* Michael De Vlieger, Jun 29 2017 *)
-
PARI
sopfr(k) = my(f=factor(k)); sum(j=1, #f~, f[j, 1]*f[j, 2]); lista(nn) = {my(record = -1); for (n=1, nn, if (! isprime(n), if ((x=sopfr(n)) > record, record = x; print1(record, ", "));););} \\ Michel Marcus, Jun 29 2017
-
Python
from sympy import factorint, isprime def sopfr(n): f=factorint(n) return sum([i*f[i] for i in f]) l=[] record=-1 for n in range(1, 501): if not isprime(n): x=sopfr(n) if x>record: record=x l.append(record) print(l) # Indranil Ghosh, Jun 29 2017
Comments