login
A071391
Least number m such that sigma(m) + phi(m) = n or 0 if no such number exists.
2
0, 1, 0, 2, 0, 3, 0, 0, 4, 5, 0, 0, 0, 6, 0, 0, 0, 0, 8, 0, 0, 10, 0, 0, 0, 13, 0, 0, 0, 14, 0, 12, 0, 17, 0, 0, 0, 19, 16, 0, 0, 0, 0, 21, 18, 22, 0, 0, 0, 20, 25, 0, 0, 26, 0, 0, 0, 27, 0, 0, 0, 31, 0, 0, 0, 0, 0, 24, 0, 34, 0, 35, 0, 37, 0, 0, 0, 38, 32, 30, 0, 41, 0, 0, 0, 43, 0, 0, 0, 0, 0, 0
OFFSET
1,4
LINKS
FORMULA
a(n) = Min{x; A000203(x)+A000010(x)=n} or a(n) = 0 if no solution exists.
EXAMPLE
n=256: a(256) = 110, sigma(110) + phi(110) = 216 + 40 = 256 = n and no positive integer k < 110 has sigma(k) + phi(k) = 256.
MATHEMATICA
f[x_] := DivisorSigma[1, x]+EulerPhi[x] t=Table[0, {100}]; Do[c=f[n]; If[c<101&&t[[c]]==0, t[[c]]=n], {n, 1, 1000000}]; t
PROG
(PARI) a(n) = for(m=1, n, if(sigma(m)+eulerphi(m)==n, return(m))); 0; \\ Jinyuan Wang, Jul 29 2020
(PARI) first(n) = { my(v = vector(n)); for(i = 1, n, c = sigma(i) + eulerphi(i); if(c <= n, if(v[c] == 0, v[c] = i ) ) ); v } \\ David A. Corneth, Jul 30 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Labos Elemer, May 23 2002
STATUS
approved