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

A061357 Number of 0

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 2, 2, 3, 2, 3, 4, 1, 3, 4, 3, 3, 5, 4, 3, 5, 3, 3, 6, 2, 5, 6, 2, 5, 6, 4, 5, 7, 4, 4, 8, 4, 4, 9, 4, 4, 7, 3, 6, 8, 5, 5, 8, 6, 7, 10, 6, 5, 12, 3, 5, 10, 3, 7, 9, 5, 5, 8, 7, 7, 11, 5, 5, 12, 4, 8, 11, 4, 8, 10, 5, 5, 13, 9, 6, 11, 7, 6, 14, 6, 8, 13, 5, 8, 11, 6, 9
Offset: 1

Views

Author

Amarnath Murthy, Apr 28 2001

Keywords

Comments

Number of prime pairs (p,q) with p < n < q and q-n = n-p.
The same as the number of ways n can be expressed as the mean of two distinct primes.
Conjecture: for n>=4 a(n)>0. - Benoit Cloitre, Apr 29 2003
Conjectures from Rick L. Shepherd, Jun 24 2003: (Start)
1) For each integer N>=1 there exists a positive integer m(N) such that for n>=m(N) a(n)>a(N). (After the first m(N)-1 terms, a(N) does not reappear). In particular, for N=1 (or 2 or 3), m(N)=4 and a(N)=0, giving Benoit Cloitre's conjecture. (cont.)
(cont.) Conjectures based upon observing a(1),...,a(10000):
m(4)=m(5)=m(6)=m(7)=m(19)=20 for a(4)=a(5)=a(6)=a(7)=a(19)=1,
m(8)=...(7 others)...=m(34)=35 for a(8)=...(7 others)...=a(34)=2,
m(12)=...(10 others)...=m(64)=65 for a(12)=...(10 others)...=a(64)=3,
m(18)=...(10 others)...=m(79)=80 for a(18)=...(10 others)...=a(79)=4,
m(24)=...(14 others)...=m(94)=95 for a(24)=...(14 others)...=a(94)=5,
m(30)=...(17 others)...=m(199)=200 for a(30)=...(17 others)...=a(199)=6, etc.
2) Each nonnegative integer appears at least once in the current sequence.
3) Stronger than 2): A001477 (nonnegative integers) is a subsequence of the current sequence. (Supporting evidence: I've observed that 0,1,2,...,175 is a subsequence of a(1),...,a(10000)).
(End)
a(n) is also the number of k such that 2*k+1=p and 2*(n-k-1)+1=q are both odd primes with p < q with p*q = n^2 - m^2. [Pierre CAMI, Sep 01 2008]
Also: Number of ways n^2 can be written as b^2+pq where 0
a(n) = sum (A010051(2*n - p): p prime < n). [Reinhard Zumkeller, Oct 19 2011]
a(n) is also the number of partitions of 2*n into two distinct primes. See the first formula by T. D. Noe, and the Alois P. Heinz, Nov 14 2012, crossreference. - Wolfdieter Lang, May 13 2016
All 0Jamie Morken, Jun 02 2017
a(n) is the number of appearances of n in A143836. - Ya-Ping Lu, Mar 05 2023

Examples

			a(10)= 2: there are two such pairs (3,17) and (7,13), as 10 = (3+17)/2 = (7+13)/2.
		

Crossrefs

Cf. A071681 (subsequence for prime n only).
Cf. A092953.
Bisection of A117929 (even part). - Alois P. Heinz, Nov 14 2012

Programs

  • Haskell
    a061357 n = sum $
       zipWith (\u v -> a010051 u * a010051 v) [n+1..] $ reverse [1..n-1]
    -- Reinhard Zumkeller, Nov 10 2012, Oct 19 2011
    
  • Mathematica
    Table[Count[Range[n - 1], k_ /; And[PrimeQ[n - k], PrimeQ[n + k]]], {n, 98}] (* Michael De Vlieger, May 14 2016 *)
  • PARI
    a(n)=my(s);forprime(p=2,n-1,s+=isprime(2*n-p));s \\ Charles R Greathouse IV, Mar 08 2013
    
  • Python
    from sympy import primerange, isprime
    def A061357(n): return sum(1 for p in primerange(n) if isprime((n<<1)-p)) # Chai Wah Wu, Sep 03 2024

Formula

a(n) = A045917(n) - A010051(n). - T. D. Noe, May 08 2007
a(n) = sum(A010051(n-k)*A010051(n+k): 1 <= k < n). - Reinhard Zumkeller, Nov 10 2012
a(n) = sum_{i=2..n-1} A010051(i)*A010051(2n-i). [Wesley Ivan Hurt, Aug 18 2013]

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), May 15 2001

A126204 Least prime representable as the arithmetic mean of two other primes in n different ways.

Original entry on oeis.org

2, 5, 11, 17, 37, 53, 89, 71, 101, 179, 137, 193, 233, 257, 251, 401, 311, 373, 347, 457, 661, 479, 547, 599, 617, 641, 683, 907, 881, 773, 827, 809, 941, 1033, 977, 1289, 1201, 1187, 1229, 1223, 1277, 1361, 1597, 1493, 1447, 1499, 1451, 1549, 1487, 1709, 1933
Offset: 0

Author

Robert G. Wilson v, Mar 22 2007

Keywords

Comments

a(n)=A000040(A137700(n)); A071681(A137700(n))=n and A071681(m)<>n for m < A137700(n). - Reinhard Zumkeller, Feb 07 2008

Crossrefs

Cf. A071681.

Programs

  • Mathematica
    f[n_] := Block[{c = 0, k = PrimePi@n - 1}, While[k > 0, If[ PrimeQ[2n - Prime@k], c++ ]; k-- ]; c]; t = Table[0, {1000}]; Do[ p = Prime@n; a = f@p; If[a < 1001 && t[[a]] == 0, t[[a]] = p; Print[{a, p}]], {n, 8900}]

Extensions

Start of b-file modified to match sequence by N. J. A. Sloane, Aug 31 2009

A071680 Primes that are the arithmetic mean of their prime predecessor and another prime.

Original entry on oeis.org

5, 37, 53, 67, 157, 173, 211, 257, 263, 277, 373, 479, 563, 593, 607, 613, 631, 653, 733, 809, 947, 977, 1009, 1103, 1123, 1187, 1223, 1297, 1367, 1471, 1511, 1607, 1663, 1721, 1747, 1753, 1783, 1867, 1901, 1907, 1931, 1993, 2137, 2287, 2377, 2411, 2417
Offset: 1

Author

Reinhard Zumkeller, May 31 2002; revised Jul 16 2003

Keywords

Comments

prime(n) where 2*prime(n) - prime(n-1) is prime. - Robert Israel, Dec 01 2015

Examples

			A000040(12) = 37, A000040(12-1) = 31, 37 = (31 + 43)/2, therefore 37 is a term.
		

Crossrefs

Cf. A071681, A006562 is a subsequence.

Programs

  • Maple
    Primes:= select(isprime, [2,seq(i,i=1..10^4,2)]):
    Primes[select(i -> isprime(2*Primes[i]-Primes[i-1]), [$2..nops(Primes)])]; # Robert Israel, Dec 01 2015
  • Mathematica
    p = q = 2; lst = {}; Do[q = Prime@n; If[PrimeQ[2q - p], AppendTo[lst, q]]; p = q, {n, 2, 400}]; lst (* Robert G. Wilson v, Mar 22 2007 *)
  • PARI
    lista(nn) = {forprime(p=5, nn, if (isprime(2*p-precprime(p-1)), print1(p, ", ")););} \\ Michel Marcus, Dec 01 2015

Extensions

Thanks to Sven Simon for noticing errors in the original version.

A078497 The member r of a triple of primes (p,q,r) in arithmetic progression which sum to 3*prime(n) = A001748(n) = p + q + r.

Original entry on oeis.org

7, 11, 17, 19, 23, 31, 29, 41, 43, 43, 53, 67, 53, 59, 71, 79, 73, 83, 79, 97, 107, 107, 127, 113, 109, 113, 139, 137, 151, 149, 167, 151, 167, 163, 163, 199, 197, 179, 191, 199, 233, 223, 227, 241, 223, 283, 257, 277, 239, 251, 271, 263, 263, 269, 281, 313
Offset: 3

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Nov 27 2002

Keywords

Comments

In case more than one triple of primes p, q=p+d and r=p+2*d exists, we take r=a(n) from the triple with the smallest d. This shows the difference from A092940, which would take the maximum r over all triples. - R. J. Mathar, May 19 2007

Examples

			a(1) = 7 because 3+5+7 = 15;
a(2) = 11 because 3+7+11 = 21;
a(3) = 17 because 5+11+17= 33.
		

Programs

  • Maple
    A078497 := proc(n) local p3, i,d,r,p; p3 := ithprime(n) ; i := n+1 ; while true do r := ithprime(i) ; d := r-p3 ; p := p3-d ; if isprime(p) then RETURN(r) ; fi ; i := i+1 ; od ; RETURN(-1) ; end: for n from 3 to 60 do printf("%d, ",A078497(n)) ; od ; # R. J. Mathar, May 19 2007
  • Mathematica
    f[n_] := Block[{p = Prime[n], k}, k = p + 1; While[ !PrimeQ[k] || !PrimeQ[2p - k], k++ ]; k]; Table[ f[n], {n, 3, 60}]

Extensions

Edited and extended by Robert G. Wilson v, Nov 29 2002
Further edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

A116619 a(n) = number of ways of representing 2*prime(n) as the unordered sum of two primes.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 4, 2, 4, 4, 3, 5, 5, 5, 5, 6, 6, 4, 6, 8, 6, 5, 6, 7, 7, 9, 7, 8, 7, 7, 9, 9, 11, 7, 11, 9, 9, 7, 11, 9, 10, 8, 10, 12, 11, 7, 11, 12, 12, 9, 13, 11, 11, 15, 14, 15, 14, 10, 11, 14, 13, 13, 15, 17, 12, 14, 14, 15, 19, 14, 19, 15, 15, 18, 15, 17, 15, 17, 16, 17, 17, 18, 17
Offset: 1

Author

Jonathan Vos Post, Mar 14 2006

Keywords

Comments

2*prime(n) = A100484(n), the n-th even semiprime.
a(n) = A071681(n) + 1. - Reinhard Zumkeller, Mar 27 2015

Examples

			2*prime(23) = 166 can be represented in 6 ways as the unordered sum of two primes: 166 = 3+163 = 17+149 = 29+137 = 53+113 = 59+107 = 83+83, so a(23) = 6.
2*prime(54) = 502 can be represented in 15 ways as the unordered sum of two primes: 502 = 3+499 = 11+491 = 23+479 = 41+461 = 53+449 = 59+443 = 71+431 = 83+419 = 101+401 = 113+389 = 149+353 = 191+311 = 233+269 = 239+263 = 251+251, so a(54) = 15.
		

Crossrefs

Programs

  • Haskell
    a116619 = (+ 1) . a071681  -- Reinhard Zumkeller, Mar 27 2015
  • PARI
    {for(n=1,83,c=0;k=2*prime(n);forprime(p=2,prime(n),if(isprime(k-p),c++));print1(c,","))} \\ Klaus Brockhaus, Dec 23 2006
    

Formula

a(n) = A045917(A100484(n)).

Extensions

Edited, corrected and extended by Klaus Brockhaus, Dec 23 2006

A071704 Number of ways to represent the n-th prime as arithmetic mean of three other odd primes.

Original entry on oeis.org

0, 0, 0, 2, 5, 7, 10, 14, 16, 24, 29, 31, 42, 40, 43, 52, 62, 70, 75, 87, 82, 96, 102, 112, 127, 137, 136, 142, 154, 154, 186, 199, 204, 215, 233, 248, 250, 262, 272, 284, 309, 324, 344, 334, 348, 358, 406, 414, 430, 446, 441, 489, 486, 511, 508
Offset: 1

Author

Reinhard Zumkeller, Jun 03 2002

Keywords

Examples

			a(5)=5 as A000040(5)=11 and there are no more representations not containing 11 than 11 = (3+7+23)/3 = (3+13+17)/3 = (5+5+23)/3 = (7+7+19)/3 = (7+13+13)/3.
		

Crossrefs

Programs

  • Haskell
    a071704 n = z (us ++ vs) 0 (3 * q)  where
       z _ 3 m = fromEnum (m == 0)
       z ps'@(p:ps) i m = if m < p then 0 else z ps' (i+1) (m - p) + z ps i m
       (us, _:vs) = span (< q) a065091_list; q = a000040 n
    -- Reinhard Zumkeller, May 24 2015
    
  • Maple
    N:= 300: # to get the first A000720(N) terms
    P:= select(isprime, [seq(i,i=3..3*N,2)]):
    nP:= nops(P):
    V:= Vector(N):
    for i from 1 to nP do
      for j from i to nP do
        for k from j to nP while P[i]+P[j]+P[k] <= 3*N do
          r:= (P[i]+P[j]+P[k])/3;
          if r::integer and isprime(r) and r <> P[j] and r <= N then V[r]:= V[r]+1 fi
    od od od:
    seq(V[ithprime(i)],i=1..numtheory:-pi(N)); # Robert Israel, Aug 09 2018
  • Mathematica
    M = 300; (* to get the first A000720(M) *)
    P = Select[Range[3, 3*M, 2], PrimeQ]; nP = Length[P]; V = Table[0, {M}];
    For[i = 1, i <= nP, i++,
    For[j = i, j <= nP, j++,
    For[k = j, k <= nP && P[[i]] + P[[j]] + P[[k]] <= 3*M , k++, r = (P[[i]] + P[[j]] + P[[k]])/3; If[IntegerQ[r] && PrimeQ[r] && r != P[[j]] && r <= M, V[[r]] = V[[r]]+1]
    ]]];
    Table[V[[Prime[i]]], {i, 1, PrimePi[M]}] (* Jean-François Alcover, Mar 09 2019, after Robert Israel *)
  • PARI
    a(n, p=prime(n))=my(s=0); forprime(q=p+2, 3*p-4, my(t=3*p-q); forprime(r=max(t-q, 3), (3*p-q)\2, if(t!=p+r && isprime(t-r), s++))); s \\ Charles R Greathouse IV, Jun 04 2015

Extensions

Definition corrected by Zak Seidov, May 24 2015

A071703 Number of ways to represent the n-th prime as arithmetic mean of three odd primes.

Original entry on oeis.org

0, 1, 2, 4, 8, 10, 14, 16, 20, 28, 32, 36, 47, 45, 48, 58, 68, 74, 81, 95, 88, 101, 108, 119, 134, 146, 143, 150, 161, 161, 195, 208, 215, 222, 244, 257, 259, 269, 283, 293, 319, 332, 354, 346, 359, 365, 417, 426, 442, 455, 454, 500, 497, 526
Offset: 1

Author

Reinhard Zumkeller, Jun 03 2002

Keywords

Examples

			a(4)=4 as A000040(4)=7 and there are no more representations than 7 = (3+5+13)/3 = (3+7+11)/3 = (5+5+11)/3 = (7+7+7)/3.
		

Crossrefs

Programs

  • Haskell
    a071703 = z a065091_list 0 . (* 3) . a000040 where
       z _ 3 m = fromEnum (m == 0)
       z ps'@(p:ps) i m = if m < p then 0 else z ps' (i+1) (m - p) + z ps i m
    -- Reinhard Zumkeller, May 24 2015

Extensions

Definition, initial term and example corrected. Thanks to Zak Seidov, who found the mistake. - Reinhard Zumkeller, May 24 2015

A178953 Indices n such that 2*prime(n) cannot be written as a sum of two distinct prime(n-k) and prime(n+k).

Original entry on oeis.org

1, 2, 4, 8, 9, 14, 15, 21, 22, 29, 30, 35, 38, 46, 48, 49, 50, 52, 53, 57, 58, 60, 61, 62, 65, 66, 90, 91, 95, 96, 97, 99, 114, 120, 121, 122, 123, 124, 125, 128, 145, 146, 149, 153, 154, 163, 176, 179, 180, 186, 187, 189, 191, 192, 197
Offset: 1

Author

Juri-Stepan Gerasimov, Jan 02 2011

Keywords

Comments

Snapshots: a(1000) = 6922, a(2000) = 16376, a(3000) = 25951, a(4000) = 37266, a(5000) = 51926, a(6000) = 69928. - R. J. Mathar, Jan 08 2011

Crossrefs

Programs

  • Haskell
    a178953 n = a178953_list !! (n-1)
    a178953_list = filter ((== 0) . a178609) [1..]
    -- Reinhard Zumkeller, Jan 30 2014
  • Maple
    A178609 := proc(n) for k from n-1 to 0 by -1 do if ithprime(n-k)+ithprime(n+k)=2*ithprime(n) then return k; end if; end do: end proc:
    for n from 1 to 200 do if A178609(n) = 0 then printf("%d,",n) ; end if; end do: # R. J. Mathar, Jan 05 2011
  • Mathematica
    A178609[n_] := For[k = n-1, k >= 0, k--, If[Prime[n-k] + Prime[n+k] == 2*Prime[n], Return[k]]]; Reap[For[n = 1, n <= 200, n++, If[A178609[n] == 0, Sow[n]]]][[2, 1]] (* Jean-François Alcover, Feb 13 2018, after R. J. Mathar *)

Formula

A178609(a(n))=0.

A137700 Smallest k such that the k-th prime has exactly n distinct representations as arithmetic mean of two primes.

Original entry on oeis.org

1, 3, 5, 7, 12, 16, 24, 20, 26, 41, 33, 44, 51, 55, 54, 79, 64, 74, 69, 88, 121, 92, 101, 109, 113, 116, 124, 155, 152, 137, 144, 140, 160, 174, 165, 209, 197, 195, 201, 200, 206, 218, 251, 238, 229, 239, 230, 244, 236, 267, 295, 281, 299, 301, 307, 312, 313, 325
Offset: 0

Author

Reinhard Zumkeller, Feb 07 2008

Keywords

Comments

A071681(a(n))=n and A071681(m)<>n for mA000040(a(n))=A126204(n).

Extensions

Corrected description suggested by Zak Seidov, May 16 2008

A253138 Number of ways to represent the n-th prime as the arithmetic mean of two semiprimes.

Original entry on oeis.org

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

Author

Michel Lagneau, Mar 23 2015

Keywords

Comments

Conjecture: a(n)>0 for n>5.
Note that a(n) = A241535(n) = A241536(n) = 0 for n=1,2 and 5. - Michel Marcus, Mar 26 2015
Among the a(n) decompositions of prime(n) into two semiprimes (prime(n)+ k)/2 and (prime(n)-k)/2, there is one where k is minimum with k = A241536(n) and there is one where k is maximum with k = prime(n) - A241535(n).

Examples

			a(12)=3 as prime(12) = 37 = (9+65)/2 = (25+49)/2 =(35+39)/2 where 9, 25, 35, 39, 49 and 65 are semiprime.
		

Crossrefs

Programs

  • Haskell
    a253138 n = sum $ map a064911 $
       takeWhile (> 0) $ map (2 * p -) $ dropWhile (< p) a001358_list
       where p = a000040 n
    -- Reinhard Zumkeller, Mar 27 2015
  • Maple
    with(numtheory):for n from 1 to 100 do:c:=0:p:=ithprime(n):for m from 1 to p-1 do:p1:=p-m:p2:=p+m:if bigomega(p1)=2 and bigomega(p2)=2 then c:=c+1:else fi:od:printf(`%d, `,c):od:
  • Mathematica
    Reap[For[n=1, n <= 100, n++, c=0; p = Prime[n]; For[m=1, m <= p-1, m++, p1 = p-m; p2 = p+m; If[PrimeOmega[p1] == 2 && PrimeOmega[p2] == 2 , c = c+1]]; Print[c]; Sow[c]]][[2, 1]] (* Jean-François Alcover, Mar 23 2015, translated from Maple *)
Showing 1-10 of 16 results. Next