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.

A067970 First differences of A014076, the odd nonprimes.

This page as a plain text file.
%I A067970 #47 Jan 09 2025 08:05:46
%S A067970 8,6,6,4,2,6,2,4,6,4,2,4,2,6,2,4,6,2,4,4,2,4,2,2,4,6,6,4,2,2,2,2,2,4,
%T A067970 4,2,6,2,2,2,6,2,4,2,4,4,2,4,2,6,2,2,2,6,6,2,2,2,2,4,2,2,2,2,4,6,4,2,
%U A067970 6,2,2,2,4,2,4,2,4,2,6,2,4,6,2,2,2,4,2,2,2,2,2,4,6,4,2,2,2,2,2,4,2,4,2,2,2
%N A067970 First differences of A014076, the odd nonprimes.
%C A067970 In this sequence 8 occurs once, but 2,4,6 may occur several times. No other even number arises. Therefore sequence consists of {8,6,4,2}.
%C A067970 Proof: If x is an odd nonprime, then x+2=next-odd-number is either nonprime[Case1] or it is a prime [Case 2]. In Case 1 the difference is 2. E.g., x=25, x+2=27, the actual difference is d=2.
%C A067970 In Case 2 x+2=p=prime. Distinguish two further subcases. In Case 2a: x+2=p=prime and p+2=x+4=q is also a prime. Then x+2+2+2=x+6 will not be prime because in first difference sequence of prime no d=2 occurs twice except for p+2=3+2=5,5+2=7, i.e., when p is divisible by 3; for 6k+1 and 6k+5 primes it is impossible. Consequently x+6 is not a prime and so the difference between two consecutive odd nonprimes is 6. Example: x=39, x+2=41=smaller twin prime and next odd nonprime x+6=45, d=6
%C A067970 In Case 2b: x+2=p=prime, but x+2+2=x+4 is not a prime, i.e., x+2=p is not a smaller one of a twin-prime pair. Thus x+4 is the next odd nonprime. Thus the difference=4. E.g., x=77, x+2=79, so the next odd nonprime is x+4=81, d=4. No more cases. QED.
%C A067970 Interestingly this sequence picks out the twin primes.
%C A067970 That the first term is special is a reflection of the simple fact that there are no 3 consecutive odd primes except from 3, 5, 7 corresponding to A067970(1) = 8 = 9-1 = (7+2)-(3-2). - _Frank Ellermann_, Feb 08 2002
%C A067970 There are arbitrarily long runs of 2's, but not of 4's or 6's. - _Zak Seidov_, Oct 01 2011
%H A067970 Jason Yuen, <a href="/A067970/b067970.txt">Table of n, a(n) for n = 1..10000</a>
%F A067970 a(n) = A014076(n+1) - A014076(n).
%F A067970 a(n) = 2 * A196274(n); a(A196276(n)) = 2; a(A196277(n)) > 2. - _Reinhard Zumkeller_, Sep 30 2011
%t A067970 a = Select[ Range[300], !PrimeQ[ # ] && !EvenQ[ # ] & ]; Table[ a[[n + 1]] - a[[n]], {n, 1, Length[a] - 1} ]
%t A067970 With[{nn=401},Differences[Complement[Range[1,nn,2],Prime[Range[PrimePi [nn]]]]]]  (* _Harvey P. Dale_, Feb 05 2012 *)
%o A067970 (Haskell)
%o A067970 a067970 n = a067970_list !! (n-1)
%o A067970 a067970_list = zipWith (-) (tail a014076_list) a014076_list
%o A067970 -- _Reinhard Zumkeller_, Sep 30 2011
%o A067970 (Python)
%o A067970 from sympy import primepi, isprime
%o A067970 def A067970(n):
%o A067970     if n == 1: return 8
%o A067970     m, k = n-1, primepi(n) + n - 1 + (n>>1)
%o A067970     while m != k:
%o A067970         m, k = k, primepi(k) + n - 1 + (k>>1)
%o A067970     for d in range(2,7,2):
%o A067970         if not isprime(m+d):
%o A067970             return d # _Chai Wah Wu_, Jul 31 2024
%Y A067970 Cf. A014076, A000230.
%Y A067970 Cf. A196274, A196276, A196277.
%K A067970 nonn
%O A067970 1,1
%A A067970 _Labos Elemer_, Feb 04 2002
%E A067970 Edited by _Robert G. Wilson v_, Feb 08 2002
%E A067970 Offset changed to 1 by _Jason Yuen_, Jan 08 2025