login
Least m such that P - m is prime, where P is the n-th perfect number.
1

%I #10 Nov 22 2023 13:02:15

%S 1,5,5,5,5,17,9,65,93,129,627,111,407,795,377,1509,257,5207,1233,8537,

%T 3917,20253,4613,15435,5619,43823

%N Least m such that P - m is prime, where P is the n-th perfect number.

%C Some of the larger entries may only correspond to probable primes.

%t e (* from A000043 *) = {2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203, 2281, 3217, 4253, 4423, ...}; PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; Do[p = 2^(e[[n]] - 1)*(2^e[[n]] - 1); Print[p - PrevPrim[p]], {n, 1, 20}]

%t #-NextPrime[#,-1]&/@PerfectNumber[Range[15]] (* The program generates the first 15 terms of the sequence. To generate more, increase the Range constant but the program may take a long time to run. *) (* _Harvey P. Dale_, Nov 22 2023 *)

%Y Cf. A061644, A000396, A000043.

%K hard,more,nonn

%O 1,2

%A _Jason Earls_, Dec 01 2002

%E Edited and extended by _Robert G. Wilson v_, Dec 03 2002

%E a(19)-a(26) from _Donovan Johnson_, Feb 22 2008