A023194 Numbers whose sum of divisors is prime.
2, 4, 9, 16, 25, 64, 289, 729, 1681, 2401, 3481, 4096, 5041, 7921, 10201, 15625, 17161, 27889, 28561, 29929, 65536, 83521, 85849, 146689, 262144, 279841, 458329, 491401, 531441, 552049, 579121, 597529, 683929, 703921, 707281, 734449, 829921, 1190281
Offset: 1
Links
- T. D. Noe and David W. Wilson, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Magma
[n: n in [1..2*10^6] | IsPrime(SumOfDivisors(n))]; // Vincenzo Librandi, May 05 2015
-
Maple
N:= 10^8: # to get all entries <= N Primes:= select(isprime, [2,seq(2*i+1, i=1..floor((sqrt(N)-1)/2))]): P2:= select(t -> (t > 2 and t < 1 + ilog2(N)), Primes): cands:= {seq(seq([p,q],p=Primes), q=P2)} union {[2,2]}: f:= proc(pq) local t,j; t:= pq[1]^(pq[2]-1); if t <= N and isprime((t*pq[1]-1)/(pq[1]-1)) then t else NULL fi end proc: map(f,cands); # if using Maple 11 or earlier, uncomment the next line # sort(convert(%,list)); # Robert Israel, Jan 13 2015
-
Mathematica
Select[ Range[ 100000 ], PrimeQ[ DivisorSigma[ 1, # ] ]& ] (* David W. Wilson *) Prepend[Select[Range[1100]^2, PrimeQ[DivisorSigma[1,#]]&],2] (* Harvey P. Dale, Dec 12 2010 *)
-
PARI
for(x=1,1000,if(isprime(sigma(x)),print(x))) /* Jorge Coveiro, Dec 23 2004 */
-
PARI
list(lim)=my(v=List([2])); forprime(p=2,sqrtint(lim\=1), if(isprime(p^2+p+1), listput(v,p^2))); forstep(e=4,logint(lim,2),2, forprime(p=2,sqrtnint(lim,e), if(isprime((p^(e+1)-1)/(p-1)), listput(v,p^e)))); Set(v) \\ Charles R Greathouse IV, Aug 17 2011; updated Jul 22 2016
-
Python
from sympy import isprime, divisor_sigma A023194_list = [2]+[n**2 for n in range(1,10**3) if isprime(divisor_sigma(n**2))] # Chai Wah Wu, Jul 14 2016
Comments