OFFSET
1,1
COMMENTS
a(n) <= prime(n).
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
For n=5, prime(5)+1 = 12; sigma(x) = 12 for x=6 and x=11, so a(5) = 6.
MAPLE
N:= 100: # to get a(1)..a(N)
for i from 1 to N do T(ithprime(i)):= i od:
count:= 0:
for n from 1 while count < N do
v:= numtheory:-sigma(n);
if T(v)::posint then
A[T(v)]:= n;
T(v):= 0;
count:= count+1;
fi
od:
seq(A[i], i=1..N);
PROG
(PARI) first(n) = my(res = vector(n), p = 2); for(k=1, n, for(x=2, p, if(sigma(x) == p+1, res[k] = x; break())); p = nextprime(p+1)); res \\ Iain Fox, Dec 28 2017
(PARI) first(n)=my(v=vector(n), P=primes(n), left=n, t); forfactored(x=2, P[n], t=setsearch(P, sigma(x)-1); if(t && v[t]==0, v[t]=x[1]; if(left--==0, return(v)))) \\ Charles R Greathouse IV, Dec 28 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Dec 27 2017
STATUS
approved