OFFSET
1,3
LINKS
FORMULA
For all primes p, a(p) = (q*(p+1)) - (p*(q+1)) = (pq + q) - (pq + p) = q - p = A001223(A000720(p)), where q = nextprime(p) = A003961(p).
And in general, a(p^e) = (q^e * (p^(e+1)-1)/(p-1)) - ((p^e) * (q^(e+1)-1)/(q-1)), where q = A003961(p).
Thus, a(p^2) = (p + 1)*q^2 - p^2*q - p^2,
a(p^3) = (p^2 + p + 1)*q^3 - p^3*q^2 - p^3*q - p^3,
a(p^4) = (p^3 + p^2 + p + 1)*q^4 - p^4*q^3 - p^4*q^2 - p^4*q - p^4,
etc.
MATHEMATICA
Array[#2 DivisorSigma[1, #1] - #1 DivisorSigma[1, #2] & @@ {#, Times @@ Map[#1^#2 & @@ # &, FactorInteger[#] /. {p_, e_} /; e > 0 :> {Prime[PrimePi@ p + 1], e}] - Boole[# == 1]} &, 68] (* Michael De Vlieger, Feb 22 2021 *)
PROG
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Antti Karttunen, Feb 22 2021
STATUS
approved