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 33 results. Next

A097224 Nondecreasing subsequence of A020481.

Original entry on oeis.org

2, 3, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 19, 19, 23, 31, 31, 47, 73, 103, 139, 173, 173, 173, 211, 233, 293, 313, 331, 359, 383, 389, 389, 523, 601, 727, 751, 829, 929, 997, 1039, 1093, 1163, 1321, 1427, 1583
Offset: 1

Views

Author

Farideh Firoozbakht, Aug 09 2004

Keywords

Crossrefs

Programs

  • Mathematica
    c[n_] := Block[{m = 2}, While[ !PrimeQ[2n - Prime[m]], m++ ]; Prime[m]]; v={2}; Do[ p = c[n]; If[ p >= v1, v1 = p; AppendTo[v, p]; Print[p]], {n, 3, 215000000}]; v

Extensions

More terms from Robert G. Wilson v, Aug 10 2004

A378020 a(n) = pi(A020482(n)) - pi(A020481(n)).

Original entry on oeis.org

0, 0, 1, 2, 1, 3, 4, 3, 5, 6, 5, 7, 6, 5, 8, 9, 8, 7, 10, 9, 11, 12, 11, 13, 12, 11, 14, 13, 12, 15, 16, 15, 14, 17, 16, 18, 19, 18, 17, 20, 19, 21, 20, 19, 22, 21, 20, 14, 23, 22, 24, 25, 24, 26, 27, 26, 28, 27, 26, 23, 25, 24, 21, 29, 28, 30, 29, 28, 31, 32, 31, 30, 28, 29, 33, 34
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Table[Module[{p = 2, q},
      While[True, q = 2 n - p; If[PrimeQ[p] && PrimeQ[q], Break[]];
       p = NextPrime[p]]; PrimePi[q] - PrimePi[p]], {n, 2, 100}]

Formula

a(n) = A377972(n) - A377758(n).

A020482 Greatest p with p, q both prime, p+q = 2n.

Original entry on oeis.org

2, 3, 5, 7, 7, 11, 13, 13, 17, 19, 19, 23, 23, 23, 29, 31, 31, 31, 37, 37, 41, 43, 43, 47, 47, 47, 53, 53, 53, 59, 61, 61, 61, 67, 67, 71, 73, 73, 73, 79, 79, 83, 83, 83, 89, 89, 89, 79, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 109, 113, 113, 109, 127, 127, 131, 131
Offset: 2

Views

Author

Keywords

Comments

a(n) = A171637(n,A035026(n)). - Reinhard Zumkeller, Mar 03 2014

Crossrefs

Programs

  • Haskell
    a020482 = last . a171637_row  -- Reinhard Zumkeller, Mar 03 2014
    
  • Mathematica
    a[n_] := {p, q} /. {ToRules @ Reduce[p+q == 2*n, {p, q}, Primes]} // Max; Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Dec 19 2013 *)
    Table[Max[Flatten[Select[IntegerPartitions[2n,{2}],AllTrue[#,PrimeQ]&]]],{n,2,70}] (* Harvey P. Dale, Sep 04 2024 *)
  • PARI
    a(n)=forprime(q=2,n,if(isprime(2*n-q), return(2*n-q))) \\ Charles R Greathouse IV, Apr 28 2015
    
  • Python
    from sympy import primerange, isprime
    def A020482(n): return next(m for p in primerange(2*n) if isprime(m:=(n<<1)-p)) # Chai Wah Wu, Nov 19 2024

A002373 Smallest prime in decomposition of 2n into sum of two odd primes.

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, 19, 3, 5, 3, 3, 5, 3, 3, 5, 3, 5, 7, 13, 11, 13, 19, 3, 5, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 7, 3, 5, 7, 3, 5, 3, 5, 7, 3, 5, 7, 3, 3, 5, 7, 11, 11, 3, 3, 5, 3
Offset: 3

Views

Author

Keywords

Comments

See A020481 for another version.
a(A208662(n)) = A065091(n) and a(m) <> A065091(n) for m < A208662(n). - Reinhard Zumkeller, Feb 29 2012
Records are in A025019, their indices in A051610. - Ralf Stephan, Dec 29 2013
Note that these primes do not all belong to a twin prime pair. The first instance is a(110) = 23. - Michel Marcus, Aug 17 2020 from a suggestion by Pierre CAMI

References

  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 80.
  • N. Pipping, Neue Tafeln für das Goldbachsche Gesetz nebst Berichtigungen zu den Haussnerschen Tafeln, Finska Vetenskaps-Societeten, Comment. Physico Math. 4 (No. 4, 1927), pp. 1-27.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a002373 n = head $ dropWhile ((== 0) . a010051 . (2*n -)) a065091_list -- Reinhard Zumkeller, Feb 29 2012
    
  • Mathematica
    Table[k = 2; While[q = Prime[k]; ! PrimeQ[2*n - q], k++]; q, {n, 3, 100}] (* Jean-François Alcover, Apr 26 2011 *)
    Table[Min[Flatten[Select[IntegerPartitions[2*n,{2}],AllTrue[ #,OddQ] && AllTrue[#,PrimeQ]&]]],{n,3,100}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 31 2020 *)
  • PARI
    a(n)=forprime(p=3,n,if(isprime(2*n-p), return(p))) \\ Charles R Greathouse IV, May 18 2015

Extensions

More terms from Ray Chandler, Sep 19 2003

A025019 Smallest prime in Goldbach partition of A025018(n).

Original entry on oeis.org

2, 3, 5, 7, 19, 23, 31, 47, 73, 103, 139, 173, 211, 233, 293, 313, 331, 359, 383, 389, 523, 601, 727, 751, 829, 929, 997, 1039, 1093, 1163, 1321, 1427, 1583, 1789, 1861, 1877, 1879, 2029, 2089, 2803, 3061, 3163, 3457, 3463, 3529, 3613, 3769, 3917, 4003, 4027, 4057
Offset: 1

Views

Author

David W. Wilson, Dec 11 1999

Keywords

Comments

Increasing subsequence of A020481.
For n > 2, a(n) ~ (log(A025018(n)))^e/e, while an upper bound could be written as UB(a(n)) = floor(log(A025018(n)))^e/2 (therefore, for any even v such that 12 <= v <= A025018(67) UB is true). It looks that both approximation and UB are true for any n > 2. Assuming the second equation to be true, UB(10^80) = 718967, UB(10^500) = 104745517, etc. - Sergey Pavlov, Jan 17 2021

Examples

			1427 and 1583 are two consecutive terms because A020481(167535419) = 1427 and A020481(209955962) = 1583 and for 167535419 < n < 209955962 A020481(n) <= 1427.
		

Crossrefs

Programs

  • Mathematica
    p = 1; q = {}; Do[ k = 2; While[ !PrimeQ[k] || !PrimeQ[2n - k], k++ ]; If[k > p, p = k; q = Append[q, p]], {n, 2, 10^8}]; q

Extensions

Edited and extended by Robert G. Wilson v, Dec 13 2002
More terms and b-file added by N. J. A. Sloane, Nov 28 2007

A138479 a(n) = smallest prime p such that 2*n + p^2 is another prime, or 0 if no such prime exists.

Original entry on oeis.org

3, 3, 5, 3, 3, 5, 3, 5, 5, 3, 3, 7, 0, 3, 7, 3, 3, 5, 3, 7, 5, 3, 5, 5, 3, 3, 5, 0, 3, 7, 3, 3, 29, 0, 3, 5, 3, 5, 5, 3, 5, 5, 0, 3, 7, 3, 3, 19, 3, 3, 5, 3, 5, 7, 0, 5, 5, 0, 3, 11, 3, 5, 5, 3, 3, 5, 0, 11, 5, 3, 3, 7, 0, 3, 7, 0, 3, 5, 3, 11, 7, 3, 5, 5, 3, 3, 5, 0, 7, 7, 3, 3, 5, 3, 3, 7, 0, 11, 5, 0
Offset: 1

Views

Author

Philippe LALLOUET (philip.lallouet(AT)orange.fr), Mar 20 2008

Keywords

Comments

For numbers k such that a(k) = 0 see A138685.

Examples

			11=2+3^2 hence a(1)=3,
13=4+3^2 hence a(2)=3,
31=6+5^2 hence a(3)=5.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local p;
          if irem(n, 3)=1 and not isprime(2*n+9) then 0
        else p:=2;
             do p:= nextprime(p);
                if isprime(2*n+p^2) then return p fi
             od
          fi
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Jun 16 2014
  • Mathematica
    a = {}; Do[ p = 0; While[ (! PrimeQ[ 2*n + Prime[ p + 1 ]2 ]) && (p < 1000), p++ ]; If[ p < 1000, AppendTo[ a, Prime[ p + 1 ] ], AppendTo[ a, 0 ] ], {n, 1, 150} ]; a (* Artur Jasinski, Mar 26 2008 *)
    a[n_]:=If[Mod[n,3]!=1,(For[m=1,!PrimeQ[2n+Prime[m]^2],m++ ]; Prime[m]),If[ !PrimeQ[2n+9],0,3]];Table[a[n],{n,100}] (* Farideh Firoozbakht, Mar 28 2008 *)

Extensions

More terms from Artur Jasinski and Farideh Firoozbakht, Mar 26 2008

A171637 Triangle read by rows in which row n lists the distinct primes of the distinct decompositions of 2n into unordered sums of two primes.

Original entry on oeis.org

2, 3, 3, 5, 3, 5, 7, 5, 7, 3, 7, 11, 3, 5, 11, 13, 5, 7, 11, 13, 3, 7, 13, 17, 3, 5, 11, 17, 19, 5, 7, 11, 13, 17, 19, 3, 7, 13, 19, 23, 5, 11, 17, 23, 7, 11, 13, 17, 19, 23, 3, 13, 19, 29, 3, 5, 11, 17, 23, 29, 31, 5, 7, 13, 17, 19, 23, 29, 31, 7, 19, 31, 3, 11, 17, 23, 29, 37, 5, 11
Offset: 2

Views

Author

Juri-Stepan Gerasimov, Dec 13 2009

Keywords

Comments

Each entry of the n-th row is a prime p from the n-th row of A002260 such that 2n-p is also prime. If A002260 is read as the antidiagonals of a square array, this sequence can be read as an irregular square array (see example below). The n-th row has length A035026(n). This sequence is the nonzero subsequence of A154725. - Jason Kimberley, Jul 08 2012

Examples

			a(2)=2 because for row 2: 2*2=2+2; a(3)=3 because for row 3: 2*3=3+3; a(4)=3 and a(5)=5 because for row 4: 2*4=3+5; a(6)=3, a(7)=5 and a(8)=7 because for row 5: 2*5=3+7=5+5.
The table starts:
2;
3;
3,5;
3,5,7;
5,7;
3,7,11;
3,5,11,13;
5,7,11,13;
3,7,13,17;
3,5,11,17,19;
5,7,11,13,17,19;
3,7,13,19,23;
5,11,17,23;
7,11,13,17,19,23;
3,13,19,29;
3,5,11,17,23,29,31;
As an irregular square array [_Jason Kimberley_, Jul 08 2012]:
3 . 3 . 3 . . . 3 . 3 . . . 3 . 3
. . . . . . . . . . . . . . . .
5 . 5 . 5 . . . 5 . 5 . . . 5
. . . . . . . . . . . . . .
7 . 7 . 7 . . . 7 . 7 . .
. . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . .
11. 11. 11. . . 11
. . . . . . . .
13. 13. 13. .
. . . . . .
. . . . .
. . . .
17. 17
. .
19
		

Crossrefs

Related triangles: A154720, A154721, A154722, A154723, A154724, A154725, A154726, A154727, A184995. - Jason Kimberley, Sep 03 2011
Cf. A020481 (left edge), A020482 (right edge), A238778 (row sums), A238711 (row products), A000040, A010051.

Programs

  • Haskell
    a171637 n k = a171637_tabf !! (n-2) !! (k-1)
    a171637_tabf = map a171637_row [2..]
    a171637_row n = reverse $ filter ((== 1) . a010051) $
       map (2 * n -) $ takeWhile (<= 2 * n) a000040_list
    -- Reinhard Zumkeller, Mar 03 2014
  • Mathematica
    Table[ps = Prime[Range[PrimePi[2*n]]]; Select[ps, MemberQ[ps, 2*n - #] &], {n, 2, 50}] (* T. D. Noe, Jan 27 2012 *)

Extensions

Keyword:tabl replaced by tabf, arbitrarily defined a(1) removed and entries checked by R. J. Mathar, May 22 2010
Definition clarified by N. J. A. Sloane, May 23 2010

A112823 Greatest p less than or equal to n with p and q both prime, p+q = 2n.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 5, 7, 7, 11, 11, 13, 11, 13, 13, 17, 17, 19, 17, 19, 13, 23, 19, 19, 23, 23, 19, 29, 29, 31, 23, 29, 31, 29, 31, 37, 29, 37, 37, 41, 41, 43, 41, 43, 31, 47, 43, 37, 47, 43, 43, 53, 47, 43, 53, 53, 43, 59, 59, 61, 53, 59, 61, 59, 61, 67, 53, 67, 67, 71, 71, 73
Offset: 2

Views

Author

Robert G. Wilson v, Sep 05 2005

Keywords

Comments

Essentially the same as A002374, which is the main entry for this sequence. - Franklin T. Adams-Watters, Jan 25 2010
Well defined only under the assumption that the yet unproved Goldbach conjecture holds, which states that any even N = 2n > 2 has a decomposition as sum of two primes. - M. F. Hasler, May 03 2019

Examples

			From _M. F. Hasler_, May 03 2019: (Start)
For n = 2, the largest prime p <= n is p = 2, and q := 2n - p = 4 - 2 = 2 is also prime, whence a(2) = 2. We see that whenever n is prime, we will have a(n) = p = q = n.
For n = 4, the largest prime p <= n is p = 3, and q := 2n - p = 8 - 3 = 5 is also prime, whence a(4) = p = 3.
For n = 8, the largest prime less than n is p' = 7, but 2n - p' = 16 - 7 = 9 is not prime, so we have to go to the next smaller prime p = 5 and now q := 2n - p = 16 - 5 = 11 is also prime, whence a(8) = p = 5. (End)
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{p = n/2}, While[ !PrimeQ[p] || !PrimeQ[n - p], p-- ]; p]; Table[ f[n], {n, 4, 146, 2}]
  • PARI
    a(n) = {my(p = precprime(n)); while (!isprime(2*n-p), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 22 2016
    
  • PARI
    A112823(n)=forprime(q=n,2*n,isprime(2*n-q)&&return(2*n-q)) \\ M. F. Hasler, May 03 2019

Formula

a(n) = n - A047160(n). - Jason Kimberley, Aug 31 2011
a(n) = n if and only if n is prime, i.e., n in A000040. - M. F. Hasler, May 03 2019

A244408 Even numbers 2k such that the smallest prime p satisfying p+q=2k (q prime) is greater than or equal to sqrt(2k).

Original entry on oeis.org

4, 6, 8, 12, 18, 24, 30, 38, 98, 122, 126, 128, 220, 302, 308, 332, 346, 488, 556, 854, 908, 962, 992, 1144, 1150, 1274, 1354, 1360, 1362, 1382, 1408, 1424, 1532, 1768, 1856, 1928, 2078, 2188, 2200, 2438, 2512, 2530, 2618, 2642, 3458, 3818, 3848
Offset: 1

Views

Author

Jon Perry, Jun 27 2014

Keywords

Comments

a(74) = 63274 is probably the last term. Oliveira e Silva's work shows there are no more terms below 4*10^18. The largest p below that is p = 9781 for 2k = 3325581707333960528, where sqrt(2k) = 1823617752. - Jens Kruse Andersen, Jul 03 2014
The sequence definition is equivalent to: "Even integers k such that there exists a prime p with p = min{q: q prime and (k-q) prime} and k <= p^2" and therefore this is a member of the EGN-family (Cf. A307782). - Corinna Regina Böger, May 01 2019

Examples

			The smallest prime for 38 is 7, and 7 >= sqrt(38).
		

Crossrefs

Programs

  • Haskell
    a244408 n = a244408_list !! (n-1)
    a244408_list = map (* 2) $ filter f [2..] where
       f x = sqrt (fromIntegral $ 2 * x) <= fromIntegral (a020481 x)
    -- Reinhard Zumkeller, Jul 07 2014
  • PARI
    for(n=1, 50000, forprime(p=2, n, if(isprime(2*n-p), if(p>=sqrt(2*n), print1(2*n", ")); break))) \\ Jens Kruse Andersen, Jul 03 2014
    

A047949 a(n) is the largest m such that n-m and n+m are both primes, or -1 if no such m exists.

Original entry on oeis.org

0, 0, 1, 2, 1, 4, 5, 4, 7, 8, 7, 10, 9, 8, 13, 14, 13, 12, 17, 16, 19, 20, 19, 22, 21, 20, 25, 24, 23, 28, 29, 28, 27, 32, 31, 34, 35, 34, 33, 38, 37, 40, 39, 38, 43, 42, 41, 30, 47, 46, 49, 50, 49, 52, 53, 52, 55, 54, 53, 48, 51, 50, 45, 62, 61, 64, 63, 62, 67, 68, 67, 66
Offset: 2

Views

Author

Keywords

Comments

A067076 is a subsequence of this sequence: when 2m+3 is prime a(m+3) = m. Moreover, it is the subsequence of records (maximal increasing subsequence): let m=a(n), with p=n-m and q=p+2m both odd primes > 3; now 3+2(m+(p-3)/2)=q and hence a(3+m+(p-3)/2) >= m+(p-3)/2 > m = a(n) but 3+m+(p-3)/2 < n. - Jason Kimberley, Aug 30 2012 and Oct 10 2012
Goldbach's conjecture says a(n) >= 0 for all n. - Robert Israel, Apr 15 2015
a(n) is the Goldbach partition of 2n which results in the maximum spread divided by 2. - Robert G. Wilson v, Jun 18 2018

Examples

			49-30=19 and 49+30=79 are primes, so a(49)=30.
		

Crossrefs

Programs

  • Haskell
    a047949 n = if null qs then -1 else head qs  where
       qs = [m | m <- [n, n-1 .. 0], a010051' (n+m) == 1, a010051' (n-m) == 1]
    -- Reinhard Zumkeller, Nov 02 2015
  • Maple
    a:= proc(n)
    local k;
      for k from n - 1 to 0 by -2 do
         if isprime(n+k) and isprime(n-k) then return(k) fi
    od:
    -1
    end proc:
    0, seq(a(n),n=3..1000); # Robert Israel, Apr 16 2015
  • Mathematica
    a[2] = a[3] = 0; a[n_] := (For[m = n - 2, m >= 0, m--, If[PrimeQ[n - m] && PrimeQ[n + m], Break[]]]; m); Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Sep 04 2013 *)
    lm[n_]:=Module[{m=n-2},While[!AllTrue[n+{m,-m},PrimeQ],m--];m]; Join[{0,0}, Array[ lm,70,4]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 03 2014 *)
    f[n_] := Block[{q = 2}, While[q <= n && !PrimeQ[2n -q], q = NextPrime@ q]; n - q]; Array[f, 72, 2] (* Robert G. Wilson v, Jun 18 2018 *)
  • PARI
    a(n) = {if (n==2 || n==3, return (0)); my(m = 1, lastm = -1, do = 1); while (do, if (isprime(n-m) && isprime(n+m), lastm = m); m++; if (m == n - 1, do = 0);); return (lastm);} \\ Michel Marcus, Jun 09 2013
    
  • PARI
    a(n)=if(n<4,0,forprime(p=3,n-1,if(isprime(2*n-p),return(n-p)));-1) \\ Ralf Stephan, Dec 29 2013
    

Formula

a(n) = n - A020481(n).
a(n) = (A020482(n) - A020481(n))/2. - Gionata Neri, Apr 15 2015

Extensions

Corrected by Harvey P. Dale, Dec 21 2000
Showing 1-10 of 33 results. Next