OFFSET
1,1
EXAMPLE
MAPLE
spf:= proc(n) option remember; local t; add(t[1]*t[2], t=ifactors(n)[2]) end proc:
f:= n -> spf(n-1)+n+spf(n+1):
g:= proc(n) option remember;
if not isprime(n) then return 0 fi;
1 + procname(f(n))
end proc:
V:= Vector(7): count:= 0:
p:= 1:
while count < 7 do
p:= nextprime(p);
v:= g(p);
if V[v] = 0 then V[v]:= p; count:= count+1 fi;
od:
convert(V, list);
MATHEMATICA
f[1] = 0; f[n_] := Plus @@ Times @@@ FactorInteger[n]; g[n_] := -1 + Length @ NestWhileList[# + f[# - 1] + f[# + 1] &, n, PrimeQ]; seq[len_, max_] := Module[{s = Table[0, {len}], c = 0, p = 1, i}, While[p < max && c < len, p = NextPrime[p]; i = g[p]; If[i <= len && s[[i]] == 0, c++; s[[i]] = p]]; s]; seq[6, 10^7] (* Amiram Eldar, May 29 2022 *)
PROG
(Python)
from sympy import factorint, isprime, nextprime
def A001414(n): return sum(p*e for p, e in factorint(n).items())
def a(n):
p, count = 1, 0
while count != n:
p = nextprime(p)
fp, count = f(p), 1
while isprime(fp): fp = f(fp); count += 1
return p
print([a(n) for n in range(1, 6)]) # Michael S. Branicky, May 29 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
J. M. Bergot and Robert Israel, May 24 2022
STATUS
approved