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

A049711 a(n) = n - prevprime(n).

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6
Offset: 3

Views

Author

Keywords

Comments

All runs end in even numbers at a(p), new highs are found at A000101 and the increasing gap size is A005250. - Robert G. Wilson v, Dec 07 2001
All terms are positive since here the variant 2 (A151799(n) < n) of the prevprime function is used, rather than the variant 1 (A007917(n) <= n). - M. F. Hasler, Sep 09 2015

Crossrefs

Programs

  • Maple
    A049711 := n-> n-prevprime(n);
  • Mathematica
    PrevPrim[n_] := Block[ {k = n - 1}, While[ !PrimeQ[k], k-- ]; Return[k]]; Table[ n - PrevPrim[n], {n, 3, 100} ]
    Array[#-NextPrime[#,-1]&,100,3] (* Harvey P. Dale, Dec 07 2011 *)
  • PARI
    A049711(n)=n-precprime(n-1) \\ M. F. Hasler, Sep 09 2015

Formula

a(n) = A064722(n-1) + 1. - Pontus von Brömssen, Jul 31 2022

A049653 a(n) = 2*n - prevprime(2*n).

Original entry on oeis.org

1, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 3, 5, 1, 1, 3, 5, 1, 3, 1, 1, 3, 1, 3, 5, 1, 3, 5, 1, 1, 3, 5, 1, 3, 1, 1, 3, 5, 1, 3, 1, 3, 5, 1, 3, 5, 7, 1, 3, 1, 1, 3, 1, 1, 3, 1, 3, 5, 7, 9, 11, 13, 1, 3, 1, 3, 5, 1, 1, 3, 5, 7, 9, 1, 1, 3, 5, 1, 3, 5, 1, 3, 1, 3, 5, 1, 3, 5, 1, 1, 3, 5, 7
Offset: 2

Views

Author

Keywords

Crossrefs

Programs

  • Magma
    [2*n - NthPrime(#PrimesUpTo(2*n)): n in [2..50]]; // G. C. Greubel, Dec 05 2017
    
  • Mathematica
    Table[2*n - NextPrime[2*n, -1], {n, 2, 50}] (* G. C. Greubel, Dec 05 2017 *)
  • PARI
    for(n=2,50, print1(2*n - precprime(2*n), ", ")) \\ G. C. Greubel, Dec 05 2017

Formula

a(n) = A049711(2*n). - R. J. Mathar, Oct 26 2015

A049613 a(n) = 2n - (largest prime < 2n-2).

Original entry on oeis.org

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

Views

Author

David M. Elder (elddm(AT)rhodes.edu)

Keywords

Examples

			a(14)=28 - (largest prime < 26) = 28 - 23 = 5.
		

Crossrefs

Programs

  • Haskell
    a049613 n = 2 * n - a007917 (2 * n - 2)
    -- Reinhard Zumkeller, Jan 02 2015
  • Mathematica
    Table[2n-NextPrime[2n-2,-1],{n,3,100}] (* Harvey P. Dale, Aug 16 2011 *)

Formula

a(n) <= A002373(n). - R. J. Mathar, Mar 19 2008
a(n) = 2*n - A007917(2*n-2). - Reinhard Zumkeller, Jan 02 2015

A049716 a(n) = 2*n + 1 - prevprime(2*n + 1).

Original entry on oeis.org

1, 2, 2, 2, 4, 2, 2, 4, 2, 2, 4, 2, 4, 6, 2, 2, 4, 6, 2, 4, 2, 2, 4, 2, 4, 6, 2, 4, 6, 2, 2, 4, 6, 2, 4, 2, 2, 4, 6, 2, 4, 2, 4, 6, 2, 4, 6, 8, 2, 4, 2, 2, 4, 2, 2, 4, 2, 4, 6, 8, 10, 12, 14, 2, 4, 2, 4, 6, 2, 2, 4, 6, 8, 10, 2, 2, 4, 6, 2, 4, 6, 2, 4, 2, 4, 6, 2, 4, 6, 2, 2, 4
Offset: 1

Views

Author

Keywords

Examples

			n:     1  2  3  4  5  6  7  8 ...
2n+1:  3  5  7  9 11 13 15 17 ...
pp:    2  3  5  7  7 11 13 13 ...
diff:  1  2  2  2  4  2  2  4 ...
		

Crossrefs

Programs

  • Maple
    seq(2*n+1-prevprime(2*n+1), n=1..100); # Robert Israel, Jul 05 2018
  • Mathematica
    Table[2n+1-NextPrime[2n+1,-1],{n,100}] (* Harvey P. Dale, Sep 21 2013 *)
  • PARI
    a(n) = 2*n+1-precprime(2*n); \\ Michel Marcus, Jul 06 2018

Formula

a(n) = A049711(2*n+1). - R. J. Mathar, Oct 26 2015

A255274 From Goldbach conjecture: Consider the pairs (2n-+1, 3), (2n-1, 5), (2n-3, 7), ..., (3, 2n+1) of odd numbers having sum 2n+4; a(n) is the index of the first pair of primes (p, q) on the list.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 3, 1, 1, 2, 3, 1, 2, 1, 1, 2, 1, 2, 3, 1, 2, 3, 1, 1, 2, 3, 1, 2, 1, 1, 2, 3, 1, 2, 1, 2, 3, 1, 2, 3, 9, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 3, 6, 5, 6, 9, 1, 2, 1, 2, 3, 1, 1, 2, 3, 5, 5, 1, 1, 2, 3, 1, 2, 3, 1, 2, 1, 2, 3, 1, 2
Offset: 1

Views

Author

Michel Lagneau, Feb 20 2015

Keywords

Comments

a(n) = A049847(n) for n = 1..46. The values of n such that a(n) is different from A049847(n) are 47, 59, 62, 72, 93, 102, 108, 123, 144, 149, 152, 161, 164, 171, 182, 197, 203, 207, 213, 227, ...
The corresponding pairs of primes are (3, 3), (3, 5), (3, 7), (5, 7), (3, 11), (3, 13), (5, 13), (3, 17), ... (A210957).

Examples

			a(13)=3 because 2*13 + 4 = 30 => 13 pairs (27,3), (25,5), (23,7), ..., (3,27) and the pair (23,7) is the third pair having prime elements.
		

Crossrefs

Programs

  • Maple
    nn:=100:for n from 6 by 2 to nn do:ii:=0:it:=1:for p from 3 by 2 to n while(ii=0) do:if type(n-p,prime)=true and type(p,prime)=true then ii:=1: printf(`%d, `,it):else it:=it+1:fi:od:od:
  • PARI
    a(n)=my(m=2*n+4); forprime(q=3, n+2, if(isprime(m-q), return(q\2))) \\ Charles R Greathouse IV, Jan 07 2022

Formula

a(n) = n + (3-A020482(n+2))/2 = (A020481(n+2)-1)/2 via the Maiga link. - Bill McEachen, Jan 02 2022

Extensions

Edited by N. J. A. Sloane, Sep 12 2017
Showing 1-5 of 5 results.