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

A229132 Initials for A159559 corresponding to records of A229019.

Original entry on oeis.org

3, 5, 7, 17, 67, 113, 163
Offset: 1

Views

Author

Vladimir Shevelev, Sep 15 2013

Keywords

Comments

Records of A229019 are 2, 11, 47, 683, 1117, 6257, 390703.

Examples

			If to take as the initial for A159559 a(4)=17, then we obtain a sequence which merges with A159559 for n equals the fourth record of A229019, that is, n=683.
		

Crossrefs

A159559 Lexicographically first strictly increasing sequence starting a(2) = 3 with the property that a(n) is prime if and only if n is prime.

Original entry on oeis.org

3, 5, 6, 7, 8, 11, 12, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 32, 33, 37, 38, 39, 40, 42, 44, 47, 48, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 67, 68, 71, 72, 74, 75, 79, 80, 81, 82, 84, 85, 89, 90, 91, 92, 93, 94, 97, 98, 101, 102, 104, 105, 106, 108, 109, 110, 111
Offset: 2

Views

Author

Vladimir Shevelev, Apr 15 2009, May 04 2009

Keywords

Comments

a(n) is prime iff n is prime.

Examples

			For n = 6, since n is composite, a(6) is the smallest composite number greater than a(6-1) = a(5) = 7, so a(6) = 8. For n = 11, since n is prime, a(11) is the smallest prime number greater than a(11-1) = a(10) = 15, so a(12) = 17. - _Michael B. Porter_, Sep 04 2016
		

Crossrefs

Programs

  • Maple
    A159559 := proc(n) option remember; if n = 2 then 3; else for a from procname(n-1)+1 do if isprime(n) and isprime(a) then RETURN(a) ; elif not isprime(n) and not isprime(a) then RETURN(a) ; fi; od: fi; end: seq(A159559(n),n=2..100) ; # R. J. Mathar, Jul 28 2009
  • Mathematica
    a[2] = 3;
    a[n_] := a[n] = If[PrimeQ[n], NextPrime[a[n-1]], NestWhile[#+1&, a[n-1]+1, PrimeQ]];
    Map[a, Range[2, 100]] (* Peter J. C. Moses, Sep 19 2013 *)
  • PARI
    nextcomposite(n)=if(n<4, return(4)); n=ceil(n); if(isprime(n),n+1,n)
    first(n)=my(v=vector(n)); v[2]=3; for(k=3,n, v[k]=if(isprime(k),nextprime(v[k-1]+1), nextcomposite(v[k-1]+1))); v[2..n] \\ Charles R Greathouse IV, Sep 21 2016

Formula

a(n+1) = min{m>a(n), m is prime}, if n+1 is prime; otherwise, a(n+1) = min{m>a(n), m is composite}.

Extensions

More terms from R. J. Mathar, Jul 28 2009

A159698 Minimal increasing sequence beginning with 4 such that n and a(n) are either both prime or both nonprime.

Original entry on oeis.org

4, 5, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 32, 33, 37, 38, 39, 40, 42, 44, 47, 48, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 67, 68, 71, 72, 74, 75, 79, 80, 81, 82, 84, 85, 89, 90, 91, 92, 93, 94, 97, 98, 101, 102, 104, 105, 106, 108, 109, 110, 111, 112
Offset: 1

Views

Author

Vladimir Shevelev, Apr 20 2009, May 04 2009

Keywords

Comments

For n >= 11, a(n) = A159559(n), which means the two sequences merge.
We may define other sequences a(p-1,n), p prime, which start a(p-1,1)=p-1 and with the same property of n and a(p-1,n) being jointly prime or nonprime.
We find that for p=7, 11 and 13, the sequences a(6,n), a(10,n) and a(12,n) also merge with the current sequence for sufficiently large n. Does this also hold for primes >=17?
It was verified for primes p with 7<=p<=223 that this sequence a(4,n) and a(p-1,n) eventually merge. The corresponding values of n are 47, 683, 1117, 6257, 390703. - Alois P. Heinz, Mar 09 2011

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; local m;
          if n=1 then 4
        else for m from a(n-1)+1 while isprime(m) xor isprime(n)
             do od; m
          fi
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Nov 21 2010
  • Mathematica
    a[n_] := a[n] = If[n==1, 4, For[m = a[n-1]+1, Xor[PrimeQ[m], PrimeQ[n]], m++]; m]; Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Jan 31 2016, after Alois P. Heinz *)

Formula

a(1) = 4; for n>1, a(n) = min { m > a(n-1) : m is prime iff n is prime }.

Extensions

More terms from Alois P. Heinz, Nov 21 2010

A276703 Let A_n be the sequence defined in the same way as A159559 but with initial term prime(n), n>=2; a(n) = max(A_n(m) - A159559(m)), m>=2.

Original entry on oeis.org

0, 4, 14, 14, 14, 70, 70, 70, 90, 90, 90, 90, 90, 90, 90, 90, 90, 121, 121, 121, 121, 121, 121, 126, 126, 126, 126, 126, 172, 172, 172, 172, 172, 172, 174, 174, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260, 2260
Offset: 2

Views

Author

Vladimir Shevelev, Sep 15 2016

Keywords

Comments

It is clear that m<=A229019(n).

Examples

			A_3(2)=5 and, by the definition of A159559 we have A_3(3)=7, A_3(4)=8, A_3(5)=11, A_3(6)=12, A_3(7)=13, A_3(8)=14, A_3(9)=15, A_3(10)=16, A_3(11)=17. Since A229019(3)=11, then comparing with the first 11 terms of A159559, we conclude that a(3)=A_3(5)-A_2(5)=4.
		

Crossrefs

Extensions

More terms from Peter J. C. Moses, Sep 15 2016

A276676 Triangle read by rows: T(n,k) (n>=2, k=2,...,n) is the minimal position at which the sequence A_n merges with the sequence A_k, where A_n be the sequence defined in the same way as A159559 but with initial term prime(n).

Original entry on oeis.org

2, 11, 2, 47, 47, 2, 47, 47, 11, 2, 47, 47, 17, 17, 2, 683, 683, 683, 683, 683, 2, 683, 683, 683, 683, 683, 11, 2, 683, 683, 683, 683, 683, 17, 17, 2, 683, 683, 683, 683, 683, 467, 467, 467, 2, 683, 683, 683, 683, 683, 467, 467, 467, 11, 2, 683, 683, 683, 683, 683, 467, 467, 467, 79, 79, 2
Offset: 2

Views

Author

Vladimir Shevelev, Sep 13 2016

Keywords

Examples

			Triangle begins
2;
11,2;
47,47,2;
47,47,11,2;
47,47,17,17,2;
683,683,683,683,683,2;
683,683,683,683,683,11,2;
683,683,683,683,683,17,17,2;
683,683,683,683,683,467,467,467,2;
683,683,683,683,683,467,467,467,11,2;
683,683,683,683,683,467,467,467,79,79,2;
683,683,683,683,683,467,467,467,79,79,17,2;
683,683,683,683,683,467,467,467,79,79,41,41,2;
683,683,683,683,683,467,467,467,79,79,41,41,11,2;
683,683,683,683,683,467,467,467,79,79,41,41,17,17,2;
683,683,683,683,683,467,467,467,107,107,107,107,107,107,107,2;
683,683,683,683,683,467,467,467,107,107,107,107,107,107,107,11,2;
The first column forms A229019.
		

Crossrefs

Cf. A159559, A229019 (the first column), A229132.

Programs

  • Mathematica
    f[n_, r_] := Block[{a}, a[2] = n; a[x_] := a[x] = If[PrimeQ@ x, NextPrime@ a[x - 1], NestWhile[# + 1 &, a[x - 1] + 1, PrimeQ@ # &]]; Map[a, Range[2, r]]]; nn = 10^4; Table[1 + First@ Flatten@ Position[BitXor[f[Prime@ n, nn], f[Prime@ k, nn]], 0], {n, 2, 12}, {k, 2, n}] // Flatten (* Michael De Vlieger, Sep 13 2016, after Peter J. C. Moses at A159559 *)

Extensions

More terms from Peter J. C. Moses, Sep 13 2016

A276767 Let A_n be the sequence defined in the same way as A159559 but with initial term prime(n), n>=2; a(n) is the smallest m such that for i>=2, A_n(i) - A_2(i) <= A_n(m) - A_2(m).

Original entry on oeis.org

2, 5, 17, 17, 17, 359, 359, 359, 163, 163, 163, 163, 163, 163, 163, 163, 163, 448, 448, 448, 448, 448, 448, 71, 71, 71, 17, 17, 443, 443, 443, 443, 443, 443, 37, 37, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789, 2789
Offset: 2

Views

Author

Vladimir Shevelev, Sep 17 2016

Keywords

Comments

By definition, A_2 = A159559.

Examples

			Let n=4. Set r(i)= A_4(i)- A_2(i), i>=2. Then, by the definition of A_4 and A_2, we have
r(2)=7-3=4,
r(3)=11-5=6, further,
r(4)=...=r(12)=6,
r(13)=r(14)=10,
r(15)=r(16)=11,
r(17)=r(18)=14,
r(19)=...=r(22)=12,
r(23)=...r(26)=10,
r(27)=9,
r(28)=8,
r(29)=...=r(32)=6,
r(33)=...=r(36)=7,
r(37)=r(38)=8,
r(39)=r(40)=7,
r(41)=r(42)=4,
r(43)=r(44)=2,
r(45)=r(46)=1
r(n)=0, n>=47.
So max r(i)=14 and the smallest m such that r(m)=14 is 17.
Thus a(4)=17.
		

Crossrefs

Extensions

More terms from Peter J. C. Moses, Sep 17 2016

A276826 a(n) is the maximal difference between the corresponding terms of sequences defined in the same way as A159559, but with initial terms A001359(n-1)+2 and A001359(n-1) respectively.

Original entry on oeis.org

4, 14, 6, 6, 6, 12, 6, 8, 14, 14, 18, 36, 24, 65, 18, 6, 10, 6, 84, 14, 162, 10, 54, 84, 179, 10, 23, 12, 18, 18, 24, 128, 18, 24, 28, 10, 10, 72, 34, 23, 12, 18, 6, 6, 12, 34, 8, 644, 12, 12, 6, 29, 24, 12, 18, 28, 28, 24, 22, 22, 10, 14, 12, 12, 16, 6, 58
Offset: 2

Views

Author

Vladimir Shevelev, Sep 19 2016

Keywords

Comments

It seems likely that 6 occurs infinitely often.

Examples

			Since A276703(3)=4 (cf. example there), a(2)=4.
		

Crossrefs

Extensions

More terms from Peter J. C. Moses, Sep 19 2016

A277118 For a lesser p of twin primes, let B_k be A159559, but with initial term k; then a(n) is the smallest m such that B_(p+2)(m)-B_p(m)>6, where p = A001359(n-1), or a(n) = 0 if there is no such m.

Original entry on oeis.org

0, 13, 0, 0, 0, 9, 0, 11, 11, 5, 3, 15, 3, 7, 3, 0, 3, 0, 3, 5, 7, 3, 11, 5, 3, 5, 11, 3, 9, 3, 3, 7, 3, 5, 5, 3, 5, 3, 5, 11, 3, 5, 0, 0, 5, 5, 7, 5, 13, 7, 0, 5, 3, 3, 3, 3, 7, 3, 3, 3, 5, 3, 7, 3, 3, 0, 3, 5, 5, 3, 11, 11, 5, 3, 5, 7, 5, 3, 0, 3, 3, 3, 3, 3
Offset: 2

Views

Author

Keywords

Comments

Theorem: a(n) takes only the values 0, 3, 5, 7, 9, 11, 13, 15, and 17.

Crossrefs

Programs

  • PARI
    nextcomposite(n)=if(n<4, return(4)); n=ceil(n); if(isprime(n), n+1, n)
    do(p)=my(a=p,b=p+2,f); for(n=3,17, f=if(isprime(n), nextprime, nextcomposite); a=f(a+1); b=f(b+1); if(b-a > 6, return(n))); 0
    p=2; forprime(q=3,1e3, if(q-p==2, print1(do(p)", ")); p=q) \\ Charles R Greathouse IV, Oct 17 2016

Formula

a(n) = 3 on a subsequence of measure 1. - Charles R Greathouse IV, Oct 17 2016

A276848 For a lesser p of twin primes, let B_(p+2) and B_p be sequences defined as A159559, but with initial terms p+2 and p respectively. The sequence lists p for which all differences B_(p+2)(n)-B_p(n)<=6.

Original entry on oeis.org

3, 11, 17, 29, 59, 227, 269, 1277, 1289, 1607, 2129, 2789, 3527, 3917, 4637, 4787, 5639, 8999, 13679, 14549, 18119, 27737, 36779, 38447, 39227, 44267, 62129, 71327, 75989, 80669, 83219, 88799, 93479, 97367, 99707, 113147, 113159, 115769, 122027, 122387, 124337, 124769, 132749, 150209, 160079
Offset: 1

Views

Author

Vladimir Shevelev, Sep 21 2016

Keywords

Comments

B_(p+2)(n) - B_p(n) < 6 for all n >= 2 if and only if p = 3.
It is astonishing that, although terms a(n) == 7 or 9 (mod 10) occur often, the first terms a(n)==1 (mod 10) are 11, 165701, ... (cf. A022009). This phenomenon is explained in the Shevelev link.

Crossrefs

Programs

  • PARI
    nextcomposite(n)=if(n<4, return(4)); n=ceil(n); if(isprime(n), n+1, n)
    is(n)=if(!isprime(n) || !isprime(n+2), return(0)); my(p=n,q=n+2,k=2,f); while(p!=q && q-p<7, f=if(isprime(k++),nextprime,nextcomposite); p=f(p+1); q=f(q+1)); p==q \\ Charles R Greathouse IV, Sep 21 2016

Extensions

More terms from Peter J. C. Moses, Sep 21 2016

A276831 For a lesser p=A001359(n-1), n>=2, of twin primes, let B_k be the sequence defined as A159559 but with initial term k; a(n) is the smallest m such that B_(p+2)(m)-B_p(m) = max_{t>=2} (B_(p+2)(t)-B_p(t)).

Original entry on oeis.org

5, 17, 11, 5, 3, 17, 3, 11, 11, 5, 31, 107, 13, 333, 17, 5, 3, 3, 281, 5, 997, 3, 487, 659, 5178, 5, 15, 3, 23, 53, 13, 1567, 13, 13, 181, 3, 5, 443, 37, 21, 19, 11, 5, 3, 5, 5, 7, 20786, 13, 7, 5, 21, 3, 5, 17, 61, 31, 23, 7, 3, 11, 5, 11, 5, 3, 3, 157, 37
Offset: 2

Views

Author

Vladimir Shevelev, Sep 20 2016

Keywords

Examples

			Let n=2, p=A001359(1)=3. Then B_3(2)=3, B_3(3)=5, B_3(4)=6, B_3(5)=7, B_3(6)=8, B_3(7)=11, B_3(8)=12, B_3(9)=14, B_3(10)=15, B_3(11)=17;
Further, B_5(2)=5, B_5(3)=7, B_5(4)=8, B_5(5)=11, B_5(6)=12, B_5(7)=13, B_5(8)=14, B_5(9)=15, B_5(10)=16, B_5(11)=17 and, beginning with t=11,
B_3 merges with B_5. So, max(B_5(t)-B_3(t))=4 reaching at t=5 and t=6.
Thus a(2)=min(5,6)=5.
		

Crossrefs

Formula

B_(p+2)(a(n)) - B_p(a(n)) = A276826(n).

Extensions

More terms from Peter J. C. Moses, Sep 20 2016
Showing 1-10 of 10 results.