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.

User: Giuseppe Coppoletta

Giuseppe Coppoletta's wiki page.

Giuseppe Coppoletta has authored 26 sequences. Here are the ten most recent ones:

A288908 Primes p whose distance from next prime and from previous prime is greater than log(p).

Original entry on oeis.org

5, 7, 23, 37, 47, 53, 89, 157, 173, 211, 251, 257, 263, 293, 331, 337, 359, 367, 373, 389, 409, 479, 631, 691, 701, 709, 719, 787, 797, 839, 919, 929, 1163, 1171, 1201, 1249, 1259, 1381, 1399, 1409, 1471, 1511, 1523, 1531, 1637, 1709, 1733, 1801, 1811, 1823
Offset: 1

Author

Giuseppe Coppoletta, Jun 19 2017

Keywords

Comments

Primes preceded and followed by larger-than-average prime gaps (see link), then included in A082885.

Examples

			n = 5 is a term because 3 + log(5) < 5 < 7 - log(5).
n = 11 is not a term because 13 - 11 < log(11) = 2.39...
		

Programs

  • Magma
    f:=func;  [p:p in PrimesInInterval(3,2000)|f(p)]; // Marius A. Burtea, Dec 19 2019
  • Mathematica
    Select[Prime@ Range[2, 300], Min@ Abs[# - NextPrime[#, {-1,1}]] > Log[#] &] (* Giovanni Resta, Jun 19 2017 *)
  • Sage
    [n for n in prime_range(3,2000) if next_prime(n)-n>log(n) and n-previous_prime(n)>log(n)]
    

Formula

A151799(a(n)) + log(a(n)) < a(n) < A151800(a(n)) - log(a(n)).

A288907 Primes p whose distance from the next prime and from the previous prime is less than log(p).

Original entry on oeis.org

71, 101, 103, 107, 109, 193, 197, 227, 229, 281, 311, 313, 349, 433, 439, 443, 461, 463, 503, 563, 569, 571, 593, 599, 601, 607, 613, 617, 643, 647, 653, 659, 677, 733, 739, 757, 823, 827, 857, 859, 881, 883, 941, 947, 971, 977, 1013, 1019, 1033, 1063, 1091, 1093
Offset: 1

Author

Giuseppe Coppoletta, Jun 19 2017

Keywords

Comments

Primes preceded and followed by less-than-average prime gaps (by the Prime Number Theorem, see link).
This sequence is a subsequence of A381850 and of A383652. - Alain Rocchelli, May 07 2025

Examples

			n = 23 is not a term because 23 - 19 > log(23) = 3.13...
n = 71 is a term because log(71) = 4.71.. and 73 - log(71) < 71 < 67 + log(71).
		

Programs

  • Maple
    q:= p-> isprime(p) and is(max(nextprime(p)-p, p-prevprime(p))Alois P. Heinz, May 12 2025
  • Mathematica
    Select[Range[2, 220] // Prime, Max[ Abs[# - NextPrime[#, {-1, 1}]]] < Log[#] &] (* Giovanni Resta, Jun 19 2017 *)
  • PARI
    is(n) = ispseudoprime(n) && n-precprime(n-1) < log(n) && nextprime(n+1)-n < log(n) \\ Felix Fröhlich, Jun 19 2017
  • Sage
    [n for n in prime_range(3,1300) if next_prime(n)-n
    				

Formula

A151800(a(n)) - log(a(n)) < a(n) < A151799(a(n)) + log(a(n)).
Conjecture: Limit_{n->oo} n / PrimePi(a(n)) = (1-1/e)^2 (A068996). - Alain Rocchelli, May 07 2025

A284036 Positive integers n such that (n^2 - 3)/2 and (n^2 + 1)/2 are twin primes.

Original entry on oeis.org

3, 5, 11, 19, 25, 29, 65, 79, 101, 205, 209, 221, 245, 275, 289, 299, 349, 371, 409, 415, 449, 521, 535, 569, 571, 575, 595, 649, 661, 695, 739, 781, 791, 935, 949, 991, 1081, 1091, 1099, 1129, 1181, 1225, 1241, 1285, 1345, 1349, 1459, 1489, 1531, 1541, 1615
Offset: 1

Author

Giuseppe Coppoletta, Mar 27 2017

Keywords

Comments

All terms are obviously odd.

Examples

			25 is a term because (25^2 - 3)/2 = 311 and (25^2 + 1)/2 = 313 are twin primes.
		

Crossrefs

Programs

  • Maple
    filter:= n -> isprime((n^2-3)/2) and isprime((n^2+1)/2):
    select(filter, [seq(i,i=1..2000,2)]); # Robert Israel, Apr 24 2017
  • Mathematica
    Select[Range[1, 1285, 2], Times @@ Boole@ Map[PrimeQ, (#^2 + {-3, 1})/2] == 1 &] (* Michael De Vlieger, Mar 28 2017 *)
  • PARI
    isok(n) = isprime((n^2 - 3)/2) && isprime((n^2 + 1)/2); \\ Michel Marcus, Apr 04 2017
    
  • Python
    from sympy import isprime
    print([n for n in range(3, 1700, 2) if isprime((n**2 - 3)//2) and isprime((n**2 + 1)//2)]) # Indranil Ghosh, Apr 04 2017
  • Sage
    [n for n in range(3,1700,2) if is_prime((n^2 - 3)//2) and is_prime((n^2 + 1)//2)]
    

A284035 Upper twin primes which correspond to the hypotenuse in a Pythagorean triple whose short leg is also a prime.

Original entry on oeis.org

5, 13, 61, 181, 421, 3121, 5101, 60901, 83641, 100801, 135721, 161881, 163021, 218461, 273061, 491041, 595141, 637321, 697381, 1064341, 1108561, 1171981, 1806901, 2574181, 2601481, 2740141, 2763601, 2853661, 3248701, 3535141, 3567121, 3696481, 3723721, 3729181, 4832941
Offset: 1

Author

Giuseppe Coppoletta, Mar 19 2017

Keywords

Comments

A284034 gives the corresponding short leg primes in the definition.

Examples

			The prime q = 3121 is in the sequence because q - 2 = 3119 is prime and {79, 3120, 3121} is a Pythagorean triple with prime short leg (see example in A284034).
		

Crossrefs

Programs

  • PARI
    lista(nn) = forprime(p=3, nn, if (isprime(p) && isprime((p^2-3)/2) && isprime(q=(p^2+1)/2), print1(q, ", "))); \\ Michel Marcus, Apr 01 2017

Formula

A284034(n)^2 + (a(n) - 1)^2 = a(n)^2, i.e., a(n) = (A284034(n)^2 + 1)/2.

Extensions

More terms from Michel Marcus, Apr 01 2017

A284034 Primes p such that (p^2 - 3)/2 and (p^2 + 1)/2 are twin primes.

Original entry on oeis.org

3, 5, 11, 19, 29, 79, 101, 349, 409, 449, 521, 569, 571, 661, 739, 991, 1091, 1129, 1181, 1459, 1489, 1531, 1901, 2269, 2281, 2341, 2351, 2389, 2549, 2659, 2671, 2719, 2729, 2731, 3109, 4049, 4349, 5279, 5431, 5471, 5531, 5591, 5669, 6329, 6359, 6871, 7559, 7741
Offset: 1

Author

Giuseppe Coppoletta, Mar 19 2017

Keywords

Comments

Primes which correspond to the short leg of an integral right triangle whose hypotenuse is part of a twin prime pair.
Each term p of the sequence must be part of a Pythagorean triple of the form {p, (p^2 - 1)/2, (p^2 + 1)/2} corresponding to {a(n), A284035(n) - 1, A284035(n)}.

Examples

			The prime p = 79 is in the sequence because (p^2-3)/2 = 3119 and (p^2+1)/2 = 3121 are twin primes. Remark that {79, 3120, 3121} is a Pythagorean triple.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime@ Range[10^3], Function[p, Times @@ Boole@ Map[PrimeQ[(p^2 + #)/2 ] &, {-3, 1}] == 1]] (* Michael De Vlieger, Mar 20 2017 *)
    Select[Prime[Range[1000]],AllTrue[{(#^2-3)/2,(#^2+1)/2},PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 04 2017 *)
  • PARI
    isok(p) = isprime(p) && isprime((p^2-3)/2) && isprime((p^2+1)/2); \\ Michel Marcus, Mar 31 2017
  • Sage
    [p for p in prime_range(10000) if is_prime((p^2-3)//2) and is_prime((p^2+1)//2)]
    

A284037 Primes p such that p-1 and p+1 have two distinct prime factors.

Original entry on oeis.org

11, 13, 19, 23, 37, 47, 53, 73, 97, 107, 163, 193, 383, 487, 577, 863, 1153, 2593, 2917, 4373, 8747, 995327, 1492993, 1990657, 5308417, 28311553, 86093443, 6879707137, 1761205026817, 2348273369087, 5566277615617, 7421703487487, 21422803359743, 79164837199873
Offset: 1

Author

Giuseppe Coppoletta, Mar 28 2017

Keywords

Comments

Either p-1 or p+1 must be of the form 2^i * 3^j, since among three consecutive numbers exactly one is a multiple of 3. - Giovanni Resta, Mar 29 2017
Subsequence of A219528. See the previous comment. - Jason Yuen, Mar 08 2025

Examples

			7 is not a term because n + 1 = 8 has only one prime factor.
23 is a term because it is prime and n - 1 = 22 has two distinct prime factors (2, 11) and n + 1 = 24 has two distinct prime factors (2, 3).
43 is not a term because n - 1 = 42 has three distinct prime factors (2, 3, 7).
		

Programs

  • Maple
    N:= 10^20: # To get all terms <= N
    Res:= {}:
    for i from 1 to ilog2(N) do
      for j from 1 to floor(log[3](N/2^i)) do
        q:= 2^i*3^j;
        if isprime(q-1) and nops(numtheory:-factorset((q-2)/2^padic:-ordp(q-2,2)))=1 then Res:= Res union {q-1} fi;
        if isprime(q+1) and nops(numtheory:-factorset((q+2)/2^padic:-ordp(q+2,2)))=1 then Res:= Res union {q+1} fi
    od od:
    sort(convert(Res,list)); # Robert Israel, Apr 16 2017
  • Mathematica
    mx = 10^30; ok[t_] := PrimeQ[t] && PrimeNu[t-1]==2==PrimeNu[t+1]; Sort@ Reap[Do[ w = 2^i 3^j; Sow /@ Select[ w+ {1,-1}, ok], {i, Log2@ mx}, {j, 1, Log[3, mx/2^i]}]][[2, 1]] (* terms up to mx, Giovanni Resta, Mar 29 2017 *)
  • PARI
    isok(n) = isprime(n) && (omega(n-1)==2) && (omega(n+1)==2); \\ Michel Marcus, Apr 17 2017
  • Sage
    omega=sloane.A001221; [n for n in prime_range(10^6) if 2==omega(n-1)==omega(n+1)]
    
  • Sage
    sorted([2^i*3^j+k for i in (1..40) for j in (1..20) for k in (-1,1) if is_prime(2^i*3^j+k) and sloane.A001221(2^i*3^j+2*k)==2])
    

Formula

A001221(a(n)) = 1 and A001221(a(n) - 1) = A001221(a(n) + 1) = 2.

Extensions

a(33)-a(34) from Giovanni Resta, Mar 29 2017

A273286 Positive integers n such that n=p+q for some primes p,q with pi(p)*pi(q) = sigma(n).

Original entry on oeis.org

92, 130, 132, 136, 154, 270, 286, 384, 398, 456, 546, 608, 630, 636, 702, 934, 944, 2730, 4394, 4470, 4556, 5544, 12084, 14320, 17572, 22632, 27808, 27930, 31150, 31284, 32534, 36346, 41004, 41544, 42274, 56916, 58552, 61680, 66654, 74826, 86200
Offset: 1

Author

Giuseppe Coppoletta, Jun 20 2016

Keywords

Comments

Equivalently, integers n such that sigma(n) = i*j for some i,j with prime(i)+prime(j) = n. Each term is necessarily even, otherwise if n is odd n=2+q < sigma(2+q) = pi(2)*pi(q) = pi(q) < q which is absurd. Also p and q cannot be equal, otherwise sigma(2*p) = 3*(p+1) = pi(p)^2 with no solution.
Conjecture: the sequence is infinite and each term has only one decomposition into a sum of suitable primes p,q.
Using Rosser's theorem we can show that the primes p,q >= 19 and each of them can only occur for a finite number of terms n. - Robert Israel, Jun 30 2016

Examples

			92 = 19 + 73 with pi(19) * pi(73) = 8 * 21 = 168 = sigma(92).
		

Crossrefs

Programs

  • Maple
    N:= 10^6: # to use primes up to N
    Primes:= select(isprime, [2,seq(i,i=3..N,2)]):
    filter:= proc(n) local s,i,j;
      s:= numtheory:-sigma(n);
      for i in select(`>=`,numtheory:-divisors(s), ceil(sqrt(s))) minus {s} do
         if i > nops(Primes) then return FAIL
         elif Primes[i] + Primes[s/i] = n then return true fi
      od:
      false
    end proc:
    A:= NULL:
    for n from 2 by 2 do
      v:= filter(n);
      if v = FAIL then break
      elif v then A:= A, n
      fi
    od:
    A; # Robert Israel, Jun 30 2016
  • Mathematica
    Select[Range[10^3], Function[n, Length@ Select[Transpose@ {#, n - #} &@ Range[Floor[n/2]], And[Times @@ Boole@ PrimeQ@ {First@ #, Last@ #} == 1, DivisorSigma[1, First@ # + Last@ #] == PrimePi[First@ #] PrimePi[Last@ #]] &] > 0]] (* Michael De Vlieger, Jun 30 2016 *)
  • PARI
    is(n) = if(n%2==1, return(0), my(x=n-1, y=1); while(x > y, if(ispseudoprime(x) && ispseudoprime(y) && sigma(x+y)==primepi(x)*primepi(y), return(1)); x--; y++); return(0)) \\ Felix Fröhlich, Jun 28 2016
    
  • PARI
    is(n) = my( d=divisors(sigma(n))); for(i=1,ceil(#d/2), if(prime(d[i]) + prime(d[#d + 1-i]) == n, return(1))); return(0) \\ David A. Corneth, Jun 30 2016
  • Sage
    def sol(n): return [j for j in divisors(sigma(n)) if j^2<= sigma(n) and is_prime(n-nth_prime(j)) and j * prime_pi(n-nth_prime(j))==sigma(n)]
    v=[n for n in range(2,100000,2) if sol(n)]
    print('list_n =',v)
    w=[sigma(n) for n in v]; print('list_sigma(n) =',w)
    list_pi(p)=flatten([sol(n) for n in range(2,100000,2) if sol(n)])
    print('list_pi(p) =',list_pi(p))
    list_pi(q)=[w[n]/list_pi[n] for n in range(len(v))]
    print('list_pi(q) =',list_pi(q))
    

Formula

Integers n such that sigma(n) = pi(q) * pi(n-q) for some prime q.

A272862 Positive integers j such that prime(i) + prime(j) = i*j for some i <= j.

Original entry on oeis.org

4, 6, 8, 24, 29, 30, 164, 165, 166, 1051, 2624, 2638, 2650, 2670, 2674, 2676, 40027, 40028, 40112, 251701, 251703, 251706, 251751, 637144, 637202, 637216, 637220, 1617162, 1617165, 4124694, 10553383, 10553408, 10553464, 10553533, 10553535, 10553839, 69709686
Offset: 1

Author

Giuseppe Coppoletta, Jul 25 2016

Keywords

Comments

Also pi(q) for primes q verifying p+q = pi(p)*pi(q) for some prime p <= q.
The list of products i*j gives A272860. See also comments there.

Examples

			8 is a term as prime(3) + prime(8) = 3*8.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[3000], Function[j, Total@ Boole@ Map[Prime@ # + Prime@ j == # j &, Range@ j] > 0]] (* Michael De Vlieger, Jul 28 2016 *)
  • PARI
    is(n) = for(i=1, n, if(prime(i)+prime(n)==i*n, return(1))); return(0) \\ Felix Fröhlich, Jul 27 2016
    
  • PARI
    is(n,p=prime(n))=my(i); forprime(q=2,p, if(i++*n==p+q, return(1))); 0
    v=List(); n=0; forprime(p=2,1e6, if(is(n++,p), listput(v,n))); Vec(v) \\ Charles R Greathouse IV, Jul 28 2016
  • Sage
    def sol(n):
        if n<5: a=n
        else: a=exp(n+1)/(n+1)
        b=(n-1)/n^2*exp(n^2/(n-1.1))
        return [j for j in range(a,b) if is_prime(n*j-nth_prime(n)) and prime_pi(n*j-nth_prime(n))==j]
    flatten([sol(i) for i in (1..15) if len(sol(i))>0]) #
    

A272860 Sums of two primes (in increasing order) when equal to the product of their prime-counting functions.

Original entry on oeis.org

12, 18, 24, 96, 116, 120, 984, 990, 996, 8408, 23616, 23742, 23850, 24030, 24066, 24084, 480324, 480336, 481344, 3523814, 3523842, 3523884, 3524514, 9557160, 9558030, 9558240, 9558300, 25874592, 25874640, 70119798, 189960894, 189961344, 189962352, 189963594, 189963630, 189969102
Offset: 1

Author

Giuseppe Coppoletta, Jun 19 2016

Keywords

Comments

Each term is necessarily even and 3 < p < q in the formula n = p+q = pi(p)*pi(q). Indeed, assuming p<=q, if p=2 then n = 2+q = pi(2)*pi(q) = pi(q) < q. Inequality p > 3 easily follows from prime(k) > k*log(k) and if p=q then 2*p = pi(p)^2 with no solution.
Primes p,q can only occur for a finite number of terms n (see comments in A273286).
Conjecture: the sequence is infinite and each term has only one decomposition into a sum of suitable primes p,q.
From David A. Corneth, Jun 28 2016: (Start)
Pi(p) and pi(q) seem dependent on each other. Below is a small list of pi(p), the least corresponding pi(q) and the largest corresponding pi(q). If a value of pi(p) isn't listed, no terms are formed with it.
3, 4, 8
4, 24, 30
6, 164, 166
8, 1051, 1051
9, 2624, 2676
12, 40027, 40112
Can these bounds on pi(q) be expressed in terms of pi(p)? (End)

Examples

			12 is a term because 12 = 5 + 7 = pi(5) * pi(7).
		

Crossrefs

Programs

  • Mathematica
    Select[Range[10^3], Function[n, MemberQ[Times @@ # & /@ PrimePi@ Select[Transpose@ {#, n - #} &@ Range[Floor[n/2]], Times @@ Boole@ PrimeQ@ {First@ #, Last@ #} == 1 &], n]]] (* Michael De Vlieger, Jun 29 2016 *)
  • Sage
    def sol(n):
        return [k for k in divisors(n) if k^2<= n and is_prime(n-nth_prime(k)) and k*prime_pi(n-nth_prime(k))==n]
    N=25000
    v=[n for n in range(2,N,2) if len(sol(n))>0]
    print('A272862 =',v)
    list_pi=flatten([sol(n) for n in range(2,N,2) if sol(n)])
    print('list_pi(p) =',list_pi)

Formula

Numbers n = p+q = pi(p)*pi(q) for some primes p and q.
Equivalently, n = i*j = prime(i) + prime(j) for some i,j.
A272862 gives the corresponding terms pi(q) (with q>p). The terms pi(p) are given by A272860 / A272862

Extensions

More terms from David A. Corneth, Jun 28 2016

A272861 Sum of two integers when equal to the product of their prime-counting functions.

Original entry on oeis.org

12, 16, 18, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 116, 120, 280, 310, 325, 330, 942, 948, 954, 960, 966, 972, 984, 990, 996, 2968, 3003, 8224, 8232, 8240, 8248, 8280, 8288, 8304, 8312, 8360, 8408, 23499, 23508, 23589
Offset: 1

Author

Giuseppe Coppoletta, Jun 18 2016

Keywords

Comments

The sums are listed in increasing order. The only term with equal addends is a(2)= 16 = 8 + 8 = pi(8)^2, Indeed j=8 is the only solution to pi(j)^2 = 2*j, which is easily seen using pi(j) > j/log(j) for j>16.

Examples

			32 is a term because 32 = 10 + 22 = 4 * 8 = pi(10) * pi(22).
		

Crossrefs

Programs

  • Mathematica
    nn = 10^3; Select[Range@ nn, Function[k, IntegerQ@ SelectFirst[Range@ nn, k == PrimePi[#] PrimePi[k - #] &]]] (* Version 10, or *)
    Select[Range[10^3], Function[n, Length@ Select[Transpose@ {#, n - #} &@ Range[Floor[n/2]], n == PrimePi[First@ #] PrimePi[Last@ #] &] > 0]] (* Michael De Vlieger, Jun 30 2016 *)
  • Sage
    def g(n): return [k for k in (3..n/2) if n==prime_pi(k)*prime_pi(n-k)]
    [n for n in range(2,1000) if len(g(n))>0]

Formula

Positive integers n such that n = pi(j) * pi(n-j) for some j.

Extensions

a(50)-a(53) from Giovanni Resta, Jun 29 2016