login
Least k such that the sum of the n greatest divisors of k is a prime number.
2

%I #26 Aug 31 2021 02:43:20

%S 2,2,4,28,16,140,24,90,120,108,60,144,300,288,120,672,252,432,240,630,

%T 960,756,480,1200,1080,1728,1680,1008,720,2016,840,3150,2160,2700,

%U 1980,4800,2520,3780,3240,8736,3960,3600,6720,6930,10800,6300,4200,16848,9240,5040

%N Least k such that the sum of the n greatest divisors of k is a prime number.

%C The corresponding primes are 2, 3, 7, 53, 31, 307, 59, 223, 331, 277, 167, 397, 853, 809, 359, 1973, 727, 1237, ...

%C The squares of the sequence are 4, 16, 144, 3600, ...

%H Chai Wah Wu, <a href="/A290126/b290126.txt">Table of n, a(n) for n = 1..1000</a>

%e a(4)=28 because the sum of the last 4 divisors of 28: 28+14+7+4 = 53 is a prime number.

%p M:= 20000: # to get all terms before the first term > M

%p R:= 'R':

%p for k from 2 to M do

%p F:= ListTools:-PartialSums(sort(convert(

%p numtheory:-divisors(k),list),`>`));

%p for n in select(t -> isprime(F[t]),[$1..nops(F)]) do

%p if not assigned(R[n]) then R[n]:= k fi

%p od

%p od:

%p inds:= map(op,{indices(R)}):

%p N:= min({$1..max(inds)+1} minus inds):

%p seq(R[i],i=1..N-1); # _Robert Israel_, Jul 24 2017

%t Table[k=1;While[Nand[Length@#>=n,PrimeQ[Total@Take[PadLeft[#,n],n]]]&@Divisors@k,k++];k,{n,1,20}](* Program from _Michael De Vlieger_ adapted for this sequence. See A289776 *)

%o (PARI) a(n) = {my(i = 2, d); while(1, d = divisors(i); if(#d >= n, if(isprime(sum(j=#d-n+1,#d,d[j])), return(i), i++), i++)); i} \\ _David A. Corneth_, Jul 20 2017

%o (Python)

%o from sympy import divisors, isprime

%o def A290126(n):

%o i = 1

%o while len(divisors(i)) < n or not isprime(sum(divisors(i)[-n:])):

%o i += 1

%o return i # _Chai Wah Wu_, Aug 05 2017

%Y Cf. A000290, A027750, A240698, A289776.

%K nonn

%O 1,1

%A _Michel Lagneau_, Jul 20 2017