login
Positions of the records in the sum-of-primes function sopfr(n) if sopfr(prime) is taken to be 0.
3

%I #22 May 06 2021 09:44:13

%S 1,4,6,8,10,14,21,22,26,34,38,46,58,62,74,82,86,94,106,118,122,134,

%T 142,146,158,166,178,194,202,206,214,218,226,254,262,274,278,298,302,

%U 314,326,334,346,358,362,382,386,394,398,422,446,454,458,466,478,482

%N Positions of the records in the sum-of-primes function sopfr(n) if sopfr(prime) is taken to be 0.

%H Indranil Ghosh, <a href="/A088686/b088686.txt">Table of n, a(n) for n = 1..2765</a> (terms < 50000)

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/SumofPrimeFactors.html">Sum of Prime Factors</a>

%t 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 *)

%o (PARI) sopfr(k) = my(f=factor(k)); sum(j=1, #f~, f[j, 1]*f[j, 2]);

%o 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

%o (Python)

%o from sympy import factorint, isprime

%o def sopfr(n):

%o f=factorint(n)

%o return sum([i*f[i] for i in f])

%o l=[]

%o record=-1

%o for n in range(1, 501):

%o if not isprime(n):

%o x=sopfr(n)

%o if x>record:

%o record=x

%o l.append(n)

%o print(l) # _Indranil Ghosh_, Jun 29 2017

%Y Cf. A001414, A088685.

%K nonn

%O 1,2

%A _Eric W. Weisstein_, Oct 05 2003