login
Composite n such that the sums of the composite numbers up to n, +/- 1, are twin primes.
1

%I #8 Jan 06 2014 10:03:57

%S 4,8,290,340,352,412,489,610,774,785,1227,1295,1306,1795,1853,1918,

%T 1945,2014,2266,2502,2885,3063,3133,3178,3265,3482,3486,3680,3760,

%U 3843,3973,3995,4124,4794,5677,5769,5965,6123,7555,7653,7696,7765,7786,8023

%N Composite n such that the sums of the composite numbers up to n, +/- 1, are twin primes.

%H Charles R Greathouse IV, <a href="/A065022/b065022.txt">Table of n, a(n) for n = 1..10000</a>

%e 4+6+8 = 18 and 18 +/-1 are twin primes.

%t Composite[n_Integer] := (k = n + PrimePi[n] + 1; While[k - PrimePi[k] - 1 != n, k++ ]; k); s = 0; Do[m = Composite[n]; s = s + m; If[ PrimeQ[s - 1] && PrimeQ[s + 1], Print[m]], {n, 1, 10^4} ]

%o (PARI) is(n)=my(s); if(isprime(n),return(0)); forcomposite(k=4,n,s+=k);isprime(s-1)&&isprime(s+1) \\ _Charles R Greathouse IV_, Jan 02 2014

%o (PARI) s=0;forcomposite(n=4,8023,s+=n;if(isprime(s-1) && isprime(s+1), print1(n", "))) \\ _Charles R Greathouse IV_, Jan 02 2014

%Y Cf. A014574, A053767.

%K nonn

%O 1,1

%A _Robert G. Wilson v_, Nov 01 2001

%E New name from _Charles R Greathouse IV_, Jan 02 2014