A304794 a(n) is the least possible difference between the greatest and the smallest prime in any partition of prime(n) into three primes p+q+r (p <= q <= r); n >= 4.
1, 2, 2, 2, 2, 6, 4, 6, 2, 6, 4, 4, 2, 6, 4, 10, 10, 12, 12, 8, 2, 8, 12, 8, 12, 10, 10, 2, 6, 4, 10, 10, 18, 18, 18, 8, 8, 2, 2, 12, 8, 12, 10, 6, 8, 12, 8, 12, 10, 4, 10, 10, 14, 14, 24, 14, 14, 8, 14, 2, 6, 4, 4, 4, 24, 20, 18, 14, 28, 14, 28, 26, 26, 4, 12
Offset: 4
Keywords
Examples
Prime(6) = 13 = 3+5+5 = 3+3+7, so a(6) = 5-3 = 2. Prime(27) = 103 = 31+31+41 = 29+37+37, A302607(27) = 31, and A302756(27) = 37; a(27) = 37-29 = 8. Prime(44) = 193 = 61+61+71 = 59+67+67, A302607(44) = 61, A302756(44) = 67; a(44) = 67-59 = 8.
Programs
-
Mathematica
Array[Min@ Map[First@ # - Last@ # &, Select[IntegerPartitions[Prime@ #, {3}], AllTrue[#, PrimeQ] &]] &, 75, 4] (* Michael De Vlieger, Jul 19 2018 *)
-
PARI
a(n) = {my(pn = prime(n), res = oo); forprime(p=2, pn, forprime(q=p, pn, forprime(r=q, pn, if (p+q+r == pn, res = min(res, r-p)); ); ); ); res; } \\ Michel Marcus, Jul 05 2018
Comments