cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A289776 Least k such that the sum of the first n divisors of k is a prime number.

This page as a plain text file.
%I A289776 #25 Sep 16 2017 03:15:56
%S A289776 2,4,30,16,84,36,60,144,144,144,144,210,324,360,630,756,756,576,660,
%T A289776 840,840,2040,900,900,2304,1980,1980,1980,4320,5184,3300,4620,5460,
%U A289776 7056,3960,4680,2520,3600,3600,3600,10080,8100,3600,6300,9900,7920,11088,14400
%N A289776 Least k such that the sum of the first n divisors of k is a prime number.
%C A289776 The corresponding primes are 3, 7, 11, 31, 23, 37, 43, 61, 79, 103, 139, 191, 523, 167, 263, 347, 431, 787, 641, ...
%C A289776 The squares in the sequence are 4, 16, 36, 144, 324, 576, 900, 2304, 3600, 5184, 7056, 8100, 14400, ...
%H A289776 Chai Wah Wu, <a href="/A289776/b289776.txt">Table of n, a(n) for n = 2..1000</a>
%e A289776 a(4)=30 because the sum of the first 4 divisors of 30 is 1 + 2 + 3 + 5 = 11, which is prime, and there is no integer below 30 with this property.
%p A289776 with(numtheory):nn:=10^6:
%p A289776 for n from 2 to 50 do:
%p A289776 ii:=0:
%p A289776    for k from 2 to nn while(ii=0) do:
%p A289776      x:=divisors(k):n0:=nops(x):
%p A289776        for l from 1 to n0 while(ii=0) do:
%p A289776         p:=sum('x[i]', 'i'=1..l):
%p A289776         if type(p,prime)=true and l=n
%p A289776          then
%p A289776          ii:=1:printf (`%d %d \n`,n,k):
%p A289776          else fi:
%p A289776         od:
%p A289776       od:
%p A289776   od:
%t A289776 Table[k = 1; While[Nand[Length@ # >= n, PrimeQ@ Total@ Take[PadRight[#, n], n]] &@ Divisors@ k, k++]; k, {n, 2, 49}] (* _Michael De Vlieger_, Jul 12 2017 *)
%o A289776 (PARI) a(n) = k=1; while((d=divisors(k)) && ((#d<n) || !isprime(sum(j=1, n, d[j]))), k++); k; \\ _Michel Marcus_, Jul 12 2017
%o A289776 (Python)
%o A289776 from sympy import divisors, isprime
%o A289776 def A289776(n):
%o A289776     i = 1
%o A289776     while len(divisors(i)) < n or not isprime(sum(divisors(i)[:n])):
%o A289776         i += 1
%o A289776     return i # _Chai Wah Wu_, Aug 05 2017
%Y A289776 Cf. A000040, A027750, A240698.
%K A289776 nonn
%O A289776 2,1
%A A289776 _Michel Lagneau_, Jul 12 2017