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

A051035 Composite numbers which can be represented as the sum of two primes (i.e., A002808 excluding A025583).

Original entry on oeis.org

4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 28, 30, 32, 33, 34, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50, 52, 54, 55, 56, 58, 60, 62, 63, 64, 66, 68, 69, 70, 72, 74, 75, 76, 78, 80, 81, 82, 84, 85, 86, 88, 90, 91, 92, 94, 96, 98, 99, 100, 102, 104, 105
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A010051, subsequence of A014092.

Programs

  • Haskell
    a051035 n = a051035_list !! (n-1)
    a051035_list = filter ((== 0) . a010051) a014091_list
  • Mathematica
    r[n_] := Reduce[2 <= p <= q && n == p + q, {p, q}, Primes]; Select[Range[4, 105], r[#] =!= False && ! PrimeQ[#] & ] (* Jean-François Alcover, Oct 29 2012 *)

A047160 For n >= 2, a(n) = smallest number m >= 0 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, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0, 5, 12, 3, 14, 9, 0, 7, 12, 9, 4, 15, 6, 7, 0, 9, 2, 3
Offset: 2

Views

Author

Keywords

Comments

I have confirmed there are no -1 entries through integers to 4.29*10^9 using PARI. - Bill McEachen, Jul 07 2008
From Daniel Forgues, Jul 02 2009: (Start)
Goldbach's Conjecture: for all n >= 2, there are primes (distinct or not) p and q s.t. p+q = 2n. The primes p and q must be equidistant (distance m >= 0) from n: p = n-m and q = n+m, hence p+q = (n-m)+(n+m) = 2n.
Equivalent to Goldbach's Conjecture: for all n >= 2, there are primes p and q equidistant (distance >= 0) from n, where p and q are n when n is prime.
If this conjecture is true, then a(n) will never be set to -1.
Twin Primes Conjecture: there is an infinity of twin primes.
If this conjecture is true, then a(n) will be 1 infinitely often (for which each twin primes pair is (n-1, n+1)).
Since there is an infinity of primes, a(n) = 0 infinitely often (for which n is prime).
(End)
If n is composite, then n and a(n) are coprime, because otherwise n + a(n) would be composite. - Jason Kimberley, Sep 03 2011
From Jianglin Luo, Sep 22 2023: (Start)
a(n) < primepi(n)+sigma(n,0);
a(n) < primepi(primepi(n)+n);
a(n) < primepi(n), for n>344;
a(n) = o(primepi(n)), as n->+oo. (End)
If -1 < a(n) < n-3, then a(n) is divisible by 3 if and only if n is not divisible by 3, and odd if and only if n is even. - Robert Israel, Oct 05 2023

Examples

			16-3=13 and 16+3=19 are primes, so a(16)=3.
		

Crossrefs

Programs

  • Haskell
    a047160 n = if null ms then -1 else head ms
                where ms = [m | m <- [0 .. n - 1],
                                a010051' (n - m) == 1, a010051' (n + m) == 1]
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Magma
    A047160:=func;[A047160(n):n in[2..100]]; // Jason Kimberley, Sep 02 2011
    
  • Mathematica
    Table[k = 0; While[k < n && (! PrimeQ[n - k] || ! PrimeQ[n + k]), k++]; If[k == n, -1, k], {n, 2, 100}]
    smm[n_]:=Module[{m=0},While[AnyTrue[n+{m,-m},CompositeQ],m++];m]; Array[smm,100,2] (* Harvey P. Dale, Nov 16 2024 *)
  • PARI
    a(n)=forprime(p=n,2*n, if(isprime(2*n-p), return(p-n))); -1 \\ Charles R Greathouse IV, Jun 23 2017
  • UBASIC
    10 N=2// 20 M=0// 30 if and{prmdiv(N-M)=N-M,prmdiv(N+M)=N+M} then print M;:goto 50// 40 inc M:goto 30// 50 inc N: if N>130 then stop// 60 goto 20
    

Formula

a(n) = n - A112823(n).
a(n) = A082467(n) * A005171(n), for n > 3. - Jason Kimberley, Jun 25 2012

Extensions

More terms from Patrick De Geest, May 15 1999
Deleted a comment. - T. D. Noe, Jan 22 2009
Comment corrected and definition edited by Daniel Forgues, Jul 08 2009

A051034 Minimal number of primes needed to sum to n.

Original entry on oeis.org

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

Views

Author

Keywords

Examples

			a(2) = 1 because 2 is already prime.
a(4) = 2 because 4 = 2+2 is a partition of 4 into 2 prime parts and there is no such partition with fewer terms.
a(27) = 3 because 27 = 3+5+19 is a partition of 27 into 3 prime parts and there is no such partition with fewer terms.
		

Crossrefs

Programs

  • Mathematica
    (* Assuming Goldbach's conjecture *) a[p_?PrimeQ] = 1; a[n_] := If[ Reduce[ n == x + y, {x, y}, Primes] === False, 3, 2]; Table[a[n], {n, 2, 112}] (* Jean-François Alcover, Apr 03 2012 *)
  • PARI
    issum(n,k)=if(k==1,isprime(n),k--;forprime(p=2,n,if(issum(n-p,k),return(1)));0)
    a(n)=my(k);while(!issum(n,k++),);k \\ Charles R Greathouse IV, Jun 01 2011

Formula

a(n) = 1 iff n is prime. a(2n) = 2 (for n > 1) if Goldbach's conjecture is true. a(2n+1) = 2 (for n >= 1) if 2n+1 is not prime, but 2n-1 is. a(2n+1) >= 3 (for n >= 1) if both 2n+1 and 2n-1 are not primes (for sufficiently large n, a(2n+1) = 3 by Vinogradov's theorem, 1937). - Franz Vrabec, Nov 30 2004
a(n) <= 3 for all n, assuming the Goldbach conjecture. - N. J. A. Sloane, Jan 20 2007
a(2n+1) <= 5, see Tao 2012. - Charles R Greathouse IV, Jul 09 2012
Assuming Goldbach's conjecture, a(n) <= 3. In particular, a(p)=1; a(2*n)=2 for n>1; a(p+2)=2 provided p+2 is not prime; otherwise a(n)=3. - Sean A. Irvine, Jul 29 2019
a(2n+1) <= 3 by Helfgott's proof of Goldbach's ternary conjecture, and hence a(n) <= 4 in general. - Charles R Greathouse IV, Oct 24 2022

Extensions

More terms from Naohiro Nomoto, Mar 16 2001

A071335 Number of partitions of n into sum of at most three primes.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 3, 2, 3, 3, 3, 3, 4, 3, 4, 4, 5, 4, 5, 4, 6, 5, 6, 6, 6, 6, 7, 5, 8, 5, 8, 5, 10, 6, 8, 8, 10, 6, 11, 5, 12, 7, 12, 7, 13, 7, 14, 9, 13, 9, 15, 7, 17, 8, 15, 8, 17, 7, 17, 10, 18, 9, 20, 8, 21, 11, 21, 8, 21, 7, 23, 11, 23, 11, 23, 10, 28, 12, 25, 11, 26
Offset: 1

Views

Author

Reinhard Zumkeller, May 19 2002

Keywords

Comments

a(n) = A010051(n) + A061358(n) + A068307(n). [From Reinhard Zumkeller, Aug 08 2009]

Examples

			a(21)=6 as 21 = 2+19 = 2+2+17 = 3+5+13 = 3+7+11 = 5+5+11 = 7+7+7.
		

Crossrefs

Programs

  • Mathematica
    goldbachcount[p1_] := (parts=IntegerPartitions[p1, 3]; count=0; n=1;
      While[n<=Length[parts], If[Intersection[Flatten[PrimeQ[parts[[n]]]]][[1]]==True, count++]; n++]; count); Table[goldbachcount[i], {i, 1, 100}] (* Frank M Jackson, Mar 25 2013 *)
    Table[Length[Select[IntegerPartitions[n,3],AllTrue[#,PrimeQ]&]],{n,90}] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 21 2016 *)

A104278 Numbers m such that 2m+1 and 2m-1 are not primes.

Original entry on oeis.org

13, 17, 25, 28, 32, 38, 43, 46, 47, 58, 59, 60, 61, 62, 67, 71, 72, 73, 77, 80, 85, 88, 92, 93, 94, 101, 102, 103, 104, 107, 108, 109, 110, 118, 122, 123, 124, 127, 130, 133, 137, 143, 144, 145, 148, 149, 150, 151, 152, 160, 161, 162, 163, 164, 167, 170, 171, 172
Offset: 1

Views

Author

Alexandre Wajnberg, Apr 17 2005

Keywords

Comments

Complement of A147820. - Omar E. Pol, Nov 17 2008
m is in the sequence iff A177961(m)Vladimir Shevelev, May 16 2010

Examples

			a(1)=13 is the first number satisfying simultaneously the two rules.
		

Crossrefs

Intersection of A047845 and A104275.

Programs

  • Haskell
    a104278 n = a104278_list !! (n-1)
    a104278_list = [m | m <- [1..],
                        a010051' (2 * m - 1) == 0 && a010051' (2 * m + 1) == 0]
    -- Reinhard Zumkeller, Aug 04 2015
    
  • Mathematica
    Select[ Range[300], !PrimeQ[2# + 1] && !PrimeQ[2# - 1] &] (* Robert G. Wilson v, Apr 18 2005 *)
    Select[Range[300],NoneTrue[2#+{1,-1},PrimeQ]&] (* The program uses the NoneTrue function from Mathematica version 10 *)  (* Harvey P. Dale, Jul 07 2015 *)
  • PARI
    select( {is_A104278(n)=!isprime(2*n-1)&&!isprime(2*n+1)}, [1..222]) \\ M. F. Hasler, Apr 29 2024

Formula

a(n) = (A025583-1)/2. - Bill McEachen, Feb 05 2025

Extensions

More terms from Robert G. Wilson v, Apr 18 2005

A218007 Number of partitions of n into at most three primes (including 1).

Original entry on oeis.org

1, 2, 3, 3, 4, 4, 5, 4, 5, 4, 5, 4, 6, 5, 7, 5, 7, 5, 8, 6, 9, 6, 9, 7, 10, 7, 10, 5, 10, 6, 12, 7, 13, 7, 12, 8, 14, 7, 14, 6, 15, 8, 17, 9, 17, 8, 18, 10, 19, 10, 19, 7, 20, 9, 21, 9, 20, 7, 21, 11, 25, 11, 24, 9, 26, 11, 27, 9, 24, 8, 28, 12, 30, 13, 29
Offset: 1

Views

Author

Frank M Jackson, Mar 26 2013

Keywords

Comments

The above sequence relies on the strong Goldbach's conjecture that any positive integer is the sum of at most three distinct terms from {1 union primes}.

Examples

			a(21)=9 as 21 = 1+1+19 = 2+19 = 1+3+17 = 2+2+17 = 1+7+13 = 3+5+13 = 3+7+11 = 5+5+11 = 7+7+7
		

Crossrefs

Programs

  • Mathematica
    primeQ[p0_] := If[p0==1, True, PrimeQ[p0]]; SetAttributes[primeQ, Listable]; goldbachcount[p1_] := (parts=IntegerPartitions[p1, 3]; count=0; n=1; While[n<=Length[parts], If[Intersection[Flatten[primeQ[parts[[n]]]]][[1]] == True, count++]; n++]; count); Table[goldbachcount[i], {i, 1, 100}]
    Table[Length[Select[#/.(1->2)&/@IntegerPartitions[n,3],AllTrue[#,PrimeQ]&]],{n,80}] (* Harvey P. Dale, Jan 11 2023 *)

A061673 Even numbers k such that k+1 and k-1 are both composite.

Original entry on oeis.org

26, 34, 50, 56, 64, 76, 86, 92, 94, 116, 118, 120, 122, 124, 134, 142, 144, 146, 154, 160, 170, 176, 184, 186, 188, 202, 204, 206, 208, 214, 216, 218, 220, 236, 244, 246, 248, 254, 260, 266, 274, 286, 288, 290, 296, 298, 300, 302, 304, 320, 322, 324, 326
Offset: 1

Views

Author

Enoch Haga, Jun 16 2001

Keywords

Comments

If a(n + 1) > a(n) + 2 then a(n) + 3 and a(n + 1) - 3 are both prime. - Joseph Wheat, Mar 16 2025

Examples

			a(3)=50 because 50 - 1 = 49 and 50 + 1 = 51 and both 49 and 51 are composite.
		

Crossrefs

A025583(n-1) - 1.

Programs

  • GAP
    Filtered([0,2..340],n->not IsPrime(n-1) and not IsPrime(n+1)); # Muniru A Asiru, Jul 01 2018;
    
  • Haskell
    a061673 n = a061673_list !! (n-1)
    a061673_list = filter bothComp [4,6..] where
       bothComp n = (1 - a010051 (n-1)) * (1 - a010051 (n+1)) > 0
    -- Reinhard Zumkeller, Feb 27 2011
    
  • Mathematica
    fQ[n_] := !PrimeQ[n - 1] && !PrimeQ[n + 1]; Select[2 Range@ 163, fQ]
    Select[Range[2,400,2],AllTrue[#+{1,-1},CompositeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 01 2014 *)
    2*SequencePosition[Table[If[CompositeQ[n],1,0],{n,1,351,2}],{1,1}][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 04 2020 *)
  • PARI
    { n=0; forstep (a=2, 3986, 2, if (!isprime(a+1) && !isprime(a-1), write("b061673.txt", n++, " ", a)) ) } \\ Harry J. Smith, Jul 26 2009
    
  • Python
    from sympy import isprime
    def abelow(limit):
      for k in range(2, limit, 2):
        if not isprime(k-1) and not isprime(k+1): yield k
    print([an for an in abelow(327)]) # Michael S. Branicky, Jan 02 2021

A109934 Composite numbers which are not the sum of two distinct primes.

Original entry on oeis.org

4, 6, 27, 35, 51, 57, 65, 77, 87, 93, 95, 117, 119, 121, 123, 125, 135, 143, 145, 147, 155, 161, 171, 177, 185, 187, 189, 203, 205, 207, 209, 215, 217, 219, 221, 237, 245, 247, 249, 255, 261, 267, 275, 287, 289, 291, 297, 299, 301, 303, 305, 321, 323, 325, 327
Offset: 1

Views

Author

Amarnath Murthy, Jul 19 2005

Keywords

Comments

Perhaps there are no even terms > 6.

Crossrefs

Cf. A025583.

Programs

  • Mathematica
    f[n_] := (p = 0; pn = PrimePi[n];
    Do[ If[n == Prime[i] + Prime[k], p = p + 1; If[p > 2, Break[]]], {i, 1, pn},
    {k, i+1, pn}]; p );
    Select[Range[2, 400], ! PrimeQ[#] && f[#] == 0 & ] (* Jean-François Alcover, Mar 07 2011 *)

A164376 Nonprime numbers that are not a sum of 2 primes.

Original entry on oeis.org

0, 1, 27, 35, 51, 57, 65, 77, 87, 93, 95, 117, 119, 121, 123, 125, 135, 143, 145, 147, 155, 161, 171, 177, 185, 187, 189, 203, 205, 207, 209, 215, 217, 219, 221, 237, 245, 247, 249, 255, 261, 267, 275, 287, 289, 291, 297, 299, 301, 303, 305, 321, 323, 325, 327
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Aug 14 2009

Keywords

Crossrefs

Programs

  • Mathematica
    f[n_] := (p = 0; pn = PrimePi[n]; Do[If[n == Prime[i] + Prime[k], p = p + 1; If[p > 2, Break[]]], {i, 1, pn}, {k, i, pn}]; p); Join[{0, 1}, Select[Range[2, 6000], ! PrimeQ[#] && f[#] == 0 &]] (* G. C. Greubel, Sep 18 2017 *)

Formula

Equals {0,1} union A025583.

Extensions

Comment turned into formula by R. J. Mathar, Aug 20 2009

A176699 Fermi-Dirac composite numbers that are not a sum of two Fermi-Dirac primes (A050376).

Original entry on oeis.org

145, 187, 205, 217, 219, 221, 247, 301, 325, 343, 415, 427, 475, 517, 535, 553, 555, 583, 637, 667, 671, 697, 715, 781, 783, 793, 795, 805, 807, 817, 835, 847, 851, 871, 895, 901, 905, 925, 959, 1003, 1005, 1027, 1045, 1057, 1059, 1075, 1081, 1135, 1141, 1147
Offset: 1

Views

Author

Vladimir Shevelev, Apr 24 2010, Apr 26 2010

Keywords

Comments

We define a Fermi-Dirac composite number as a positive integer with at least two factors in its factorization over distinct terms of A050376.
They are those c for which A064547(c) >= 2, namely c= 6, 8, 10, 12,..., 62, 63, 64, 65, ..., or the complement of A050376 with respect to the natural numbers > 1.

Examples

			291 = 3*97 is a Fermi-Dirac composite number, equal to 289+2, the sum of two Fermi-Dirac primes. Therefore 291 is not in the sequence.
		

References

  • Vladimir S. Shevelev, Multiplicative functions in the Fermi-Dirac arithmetic, Izvestia Vuzov of the North-Caucasus region, Nature Sciences 4 (1996), 28-43.

Crossrefs

Programs

  • Maple
    A064547 := proc(n) f := ifactors(n)[2] ; a := 0 ; for p in f do a := a+wt(op(2, p)) ; end do: a ; end proc:
    A050376 := proc(n) local a; if n = 1 then 2; else for a from procname(n-1)+1 do if A064547(a) = 1 then return a; end if; end do: end if; end proc:
    isA176699 := proc(n) local pi,q ; if A064547(n) < 2 then return false; end if; for pi from 1 do if A050376(pi) > n then return true; else q := n-A050376(pi) ; if A064547(q) = 1 then return false; end if; end if; end do; end proc:
    for n from 2 to 1000 do if isA176699(n) then printf("%d,\n",n) ; end if; end do: # R. J. Mathar, Jun 16 2010
  • Mathematica
    pow2Q[n_] := n == 2^IntegerExponent[n, 2]; fdpQ[n_] := PrimePowerQ[n] && pow2Q[FactorInteger[n][[1, 2]]]; With[{m = 1200}, p = Select[Range[m], fdpQ]; Complement[Range[m], Join[{1}, p, Plus @@@ Subsets[p, {2}]]]] (* Amiram Eldar, Oct 05 2023 *)

Extensions

Edited and extended by R. J. Mathar, Jun 16 2010
More terms from Amiram Eldar, Oct 05 2023
Showing 1-10 of 12 results. Next