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-2 of 2 results.

A129145 Alternately odd prime and odd composite numbers.

Original entry on oeis.org

3, 9, 5, 15, 7, 21, 11, 25, 13, 27, 17, 33, 19, 35, 23, 39, 29, 45, 31, 49, 37, 51, 41, 55, 43, 57, 47, 63, 53, 65, 59, 69, 61, 75, 67, 77, 71, 81, 73, 85, 79, 87, 83, 91, 89, 93, 97, 95, 101, 99, 103, 105, 107, 111, 109, 115, 113, 117, 127, 119, 131, 121, 137, 123, 139, 125
Offset: 1

Views

Author

Zak Seidov, Apr 01 2007

Keywords

Comments

For small n's a(2n) >a(2n-1) (that is for small n's, n-th odd prime less than n-th odd composite number), while for large n's a(2n) A129146

Crossrefs

Programs

  • Mathematica
    Module[{nn=100,pr,cm,len},pr=Prime[Range[2,nn+1]];cm=Select[Range[ 9,2nn+1,2],CompositeQ];len=Min[Length[pr],Length[cm]];Riffle[Take[ pr,len],Take[cm,len]]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 10 2019 *)
  • Python
    from sympy import prime, primepi
    def A129145(n):
        if n&1: return prime((n>>1)+2)
        if n==2: return 9
        r = n>>1
        m, k = r, primepi(r) + r + (r>>1)
        while m != k:
            m, k = k, primepi(k) + r + (k>>1)
        return m # Chai Wah Wu, Aug 01 2024

Formula

a(2n-1)=A065091(n), a(2n) =A071904(n).

A163504 a(n) = abs(n-th prime minus n-th odd nonprime).

Original entry on oeis.org

1, 6, 10, 14, 14, 14, 16, 16, 16, 16, 18, 14, 14, 14, 16, 12, 10, 14, 10, 10, 12, 8, 8, 4, 2, 2, 2, 4, 6, 4, 8, 10, 14, 14, 20, 18, 22, 22, 24, 28, 32, 28, 36, 34, 36, 34, 42, 52, 52, 52, 50, 54, 54, 62, 62, 62, 66, 66, 70, 72, 70, 78, 90, 92, 92, 92, 100, 102, 110, 106, 108, 112
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jul 29 2009

Keywords

Examples

			a(1)=abs(2-1)=1; a(2)=abs(3-9)=6.
		

Crossrefs

Programs

  • Maple
    A014076 := proc(n) option remember; local a; if n = 1 then 1; else for a from procname(n-1)+2 by 2 do if not isprime(a) then return a; end if; end do: end if; end proc: A163504 := proc(n) abs(ithprime(n)-A014076(n)) ; end: seq(A163504(n),n=1..80) ; # R. J. Mathar, Oct 10 2009
  • Mathematica
    A014076 := Select[Range[1, 10000, 2], PrimeOmega[#] != 1 &]; Table[Abs[Prime[n] - A014076[[n]]], {n,1,50}] (* G. C. Greubel, Jul 27 2017 *)
    Module[{nn=250,onp},onp=Select[Range[1,nn,2],!PrimeQ[#]&];Abs[#[[1]]-#[[2]]]&/@Thread[{Prime[Range[Length[onp]]],onp}]] (* Harvey P. Dale, Dec 07 2024 *)

Formula

a(n) = abs(A000040(n)-A014076(n)).

Extensions

An 8 inserted by R. J. Mathar, Oct 10 2009
Showing 1-2 of 2 results.