A088686 Positions of the records in the sum-of-primes function sopfr(n) if sopfr(prime) is taken to be 0.
1, 4, 6, 8, 10, 14, 21, 22, 26, 34, 38, 46, 58, 62, 74, 82, 86, 94, 106, 118, 122, 134, 142, 146, 158, 166, 178, 194, 202, 206, 214, 218, 226, 254, 262, 274, 278, 298, 302, 314, 326, 334, 346, 358, 362, 382, 386, 394, 398, 422, 446, 454, 458, 466, 478, 482
Offset: 1
Keywords
Links
- Indranil Ghosh, Table of n, a(n) for n = 1..2765 (terms < 50000)
- Eric Weisstein's World of Mathematics, Sum of Prime Factors
Programs
-
Mathematica
Function[s, Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]] ]@ Table[Total@ Flatten@ Map[ConstantArray[#1, #2] /. 1 -> 0 & @@ # &, FactorInteger@ n] - n Boole[PrimeQ@ n], {n, 500}] (* 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(n, ", "));););} \\ 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(n) print(l) # Indranil Ghosh, Jun 29 2017