OFFSET
2,1
EXAMPLE
For n=12, sopf(12) = sopf(12+6), and there is no positive k < 6 such that sopf(12) = sopf(12+k), so a(12)=6.
MAPLE
f:= proc(n)
add( d, d= numtheory[factorset](n)) ;
end proc:
g := proc(n)
local k;
for k from 1 do
if f(n+k) = f(n) then
return k;
fi;
end do;
end proc:map(g, [$2..100]);
MATHEMATICA
sopf[n_]:=Total[First/@FactorInteger[n]]; a[n_]:=Module[{k=1}, While[sopf[n]!=sopf[n+k], k++]; k]; Array[a, 65, 2] (* Stefano Spezia, Mar 26 2024 *)
PROG
(Python)
from sympy import primefactors
def f(n):
return sum(primefactors(n))
def g(n):
k = 1
while True:
if f(n + k) == f(n):
return k
k += 1
print([g(i) for i in range(2, 100)])
(PARI) sopf(n) = vecsum(factor(n)[, 1]); \\ A008472
a(n) = my(k=1, s=sopf(n)); while (sopf(n+k) != s, k++); k; \\ Michel Marcus, Mar 25 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Rafik Khalfi, Mar 22 2024
STATUS
approved