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.

Showing 1-3 of 3 results.

A067970 First differences of A014076, the odd nonprimes.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Labos Elemer, Feb 04 2002

Keywords

Comments

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}.
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.
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
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.
Interestingly this sequence picks out the twin primes.
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
There are arbitrarily long runs of 2's, but not of 4's or 6's. - Zak Seidov, Oct 01 2011

Crossrefs

Programs

  • Haskell
    a067970 n = a067970_list !! (n-1)
    a067970_list = zipWith (-) (tail a014076_list) a014076_list
    -- Reinhard Zumkeller, Sep 30 2011
    
  • Mathematica
    a = Select[ Range[300], !PrimeQ[ # ] && !EvenQ[ # ] & ]; Table[ a[[n + 1]] - a[[n]], {n, 1, Length[a] - 1} ]
    With[{nn=401},Differences[Complement[Range[1,nn,2],Prime[Range[PrimePi [nn]]]]]]  (* Harvey P. Dale, Feb 05 2012 *)
  • Python
    from sympy import primepi, isprime
    def A067970(n):
        if n == 1: return 8
        m, k = n-1, primepi(n) + n - 1 + (n>>1)
        while m != k:
            m, k = k, primepi(k) + n - 1 + (k>>1)
        for d in range(2,7,2):
            if not isprime(m+d):
                return d # Chai Wah Wu, Jul 31 2024

Formula

a(n) = A014076(n+1) - A014076(n).
a(n) = 2 * A196274(n); a(A196276(n)) = 2; a(A196277(n)) > 2. - Reinhard Zumkeller, Sep 30 2011

Extensions

Edited by Robert G. Wilson v, Feb 08 2002
Offset changed to 1 by Jason Yuen, Jan 08 2025

A196274 Half of the gaps A067970 between odd nonprimes A014076.

Original entry on oeis.org

4, 3, 3, 2, 1, 3, 1, 2, 3, 2, 1, 2, 1, 3, 1, 2, 3, 1, 2, 2, 1, 2, 1, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 2, 2, 1, 3, 1, 1, 1, 3, 1, 2, 1, 2, 2, 1, 2, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 2, 1, 3, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 2, 3, 1, 1, 1, 2
Offset: 1

Views

Author

M. F. Hasler, Sep 30 2011

Keywords

Comments

a(n) < 4 for n > 1; a(A196276(n)) = 1; a(A196277(n)) > 1. - Reinhard Zumkeller, Sep 30 2011
Lengths of runs of equal terms in A025549. That sequence begins with: 1,1,1,1,3,3,3,45,45,45,..., that is 4 ones, 3 threes, 3 forty-fives, ... - Michel Marcus, Dec 02 2014

Examples

			The smallest odd numbers which are not prime are 1, 9, 15, 21, 25, 27,... (sequence A014076).
The gaps between these are: 8, 6, 6, 4, 2,... (sequence A067970), which are of course all even by construction, so it makes sense to divide all of them by 2, which yields this sequence: 4, 3, 3, 2, 1, ...
		

Crossrefs

Cf. A142723 for the decimal value of the associated continued fraction.

Programs

  • Mathematica
    With[{nn=401},Differences[Complement[Range[1,nn,2],Prime[Range[ PrimePi[ nn]]]]]/2] (* Harvey P. Dale, May 06 2012 *)
  • PARI
    L=1;forstep(n=3,299,2,isprime(n)&next;print1((n-L)/2",");L=n)
    
  • Python
    from sympy import primepi, isprime
    def A196274(n):
        if n == 1: return 4
        m, k = n-1, primepi(n) + n - 1 + (n>>1)
        while m != k:
            m, k = k, primepi(k) + n - 1 + (k>>1)
        for d in range(1,4):
            if not isprime(m+(d<<1)):
                return d # Chai Wah Wu, Jul 31 2024

Formula

a(n) = (A014076(n+1)-A014076(n))/2 = A067970(n)/2.

Extensions

More terms from Harvey P. Dale, May 06 2012

A196277 Numbers m such that A196274(m) > 1.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 9, 10, 12, 14, 16, 17, 19, 20, 22, 25, 26, 27, 28, 34, 35, 37, 41, 43, 45, 46, 48, 50, 54, 55, 60, 65, 66, 67, 69, 73, 75, 77, 79, 81, 82, 86, 92, 93, 94, 100, 102, 106, 107, 109, 112, 114, 116, 117, 119, 122, 123, 126, 130, 134, 136, 137
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 30 2011

Keywords

Comments

Complement of A196276; A196274(a(n)) > 1;
A047846(n+1) = a(n+1) - a(n).

Programs

  • Haskell
    import Data.List (findIndices)
    a196277 n = a196277_list !! (n-1)
    a196277_list = map (+ 1) $ findIndices (> 1) a196274_list
Showing 1-3 of 3 results.