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.

Previous Showing 11-20 of 28 results. Next

A087711 a(n) = smallest number k such that both k-n and k+n are primes.

Original entry on oeis.org

2, 4, 5, 8, 7, 8, 11, 10, 11, 14, 13, 18, 17, 16, 17, 22, 21, 20, 23, 22, 23, 26, 25, 30, 29, 28, 33, 32, 31, 32, 37, 36, 35, 38, 37, 38, 43, 42, 41, 44, 43, 48, 47, 46, 57, 52, 51, 50, 53, 52, 53, 56, 55, 56, 59, 58, 75, 70, 69, 72, 67, 66, 65, 68, 67, 72, 71, 70, 71, 80, 81, 78
Offset: 0

Views

Author

Zak Seidov, Sep 28 2003

Keywords

Comments

Let b(n), c(n) and d(n) be respectively, smallest number m such that phi(m-n) + sigma(m+n) = 2n, smallest number m such that phi(m+n) + sigma(m-n) = 2n and smallest number m such that phi(m-n) + sigma(m+n) = phi(m+n) + sigma(m-n), we conjecture that for each positive integer n, a(n)=b(n)=c(n)=d(n). Namely we conjecture that for each positive integer n, a(n) < A244446(n), a(n) < A244447(n) and a(n) < A244448(n). - Jahangeer Kholdi and Farideh Firoozbakht, Sep 05 2014

Examples

			n=10: k=13 because 13-10 and 13+10 are both prime and 13 is the smallest k such that k +/- 10 are both prime
4-1=3, prime, 4+1=5, prime; 5-2=3, 5+2=7; 8-3=5, 8+3=11; 9-4=5, 9+4=13, ...
		

Crossrefs

Programs

  • Magma
    distance:=function(n); k:=n+2; while not IsPrime(k-n) or not IsPrime(k+n) do k:=k+1; end while; return k; end function; [ distance(n): n in [1..71] ]; /* Klaus Brockhaus, Apr 08 2007 */
    
  • Maple
    Primes:= select(isprime,{seq(2*i+1,i=1..10^3)}):
    a[0]:= 2:
    for n from 1 do
      Q:= Primes intersect map(t -> t-2*n,Primes);
      if nops(Q) = 0 then break fi;
      a[n]:= min(Q) + n;
    od:
    seq(a[i],i=0..n-1); # Robert Israel, Sep 08 2014
  • Mathematica
    s = ""; k = 0; For[i = 3, i < 22^2, If[PrimeQ[i - k] && PrimeQ[i + k], s = s <> ToString[i] <> ","; k++ ]; i++ ]; Print[s] (* Vladimir Joseph Stephan Orlovsky, Apr 03 2008 *)
    snk[n_]:=Module[{k=n+1},While[!PrimeQ[k+n]||!PrimeQ[k-n],k++];k]; Array[ snk,80,0] (* Harvey P. Dale, Dec 13 2020 *)
  • PARI
    a(n)=my(k);while(!isprime(k-n) || !isprime(k+n),k++);return(k) \\ Edward Jiang, Sep 05 2014

Formula

a(n) = A020483(n)+n for n >= 1. - Robert Israel, Sep 08 2014

Extensions

Entries checked by Klaus Brockhaus, Apr 08 2007

A078587 Largest prime p such that p

Original entry on oeis.org

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

Views

Author

T. D. Noe, Dec 02 2002

Keywords

Comments

Suggested by Goldbach Conjecture.
Also, values of p from A143697. This follows from the factorization n^2-k^2 = (n-k)(n+k). - T. D. Noe, Jan 22 2009

Crossrefs

Programs

  • Mathematica
    Table[p=n+1; q=2n-p; While[q>0&&!(PrimeQ[p]&&PrimeQ[q]), p++; q-- ]; q, {n, 4, 100}]
  • PARI
    a(n) = {my(p = precprime(n-1)); while(!isprime(2*n-p), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 22 2016

Formula

a(n) = 2n - A078496(n)

Extensions

Edited by N. J. A. Sloane, Jan 24 2009 at the suggestion of R. J. Mathar and T. D. Noe.

A172989 Smallest k such that the two numbers n^2 +- k are primes.

Original entry on oeis.org

1, 2, 3, 6, 5, 12, 3, 2, 3, 18, 5, 12, 3, 2, 15, 18, 7, 12, 21, 2, 63, 42, 55, 6, 15, 10, 27, 12, 19, 78, 15, 2, 93, 12, 5, 78, 15, 10, 21, 12, 23, 18, 57, 14, 27, 30, 7, 120, 117, 8, 15, 42, 37, 24, 27, 58, 93, 18, 7, 12, 75, 38, 3, 6, 7, 132, 27, 28, 69, 18, 5, 102, 27, 34, 75, 78, 5
Offset: 2

Views

Author

Keywords

Examples

			2^2 +- 1 are both prime, 3^2 +- 2 are both prime, 4^2 +- 3 are both prime, 5^2 +- 6 are both prime, ...
		

Crossrefs

Cf. A060272 (at least one prime), A082467 (supersequence).

Programs

  • Magma
    sol:=[]; for m in [2..80] do for k in [1..200] do if IsPrime(m^2-k) and IsPrime(m^2+k) then sol[m-1]:=k; break; end if; end for; end for; sol; // Marius A. Burtea, Jul 28 2019
  • Mathematica
    f[n_]:=Block[{k},If[OddQ[n],k=2,k=1];While[ !PrimeQ[n-k]||!PrimeQ[n+k],k+=2];k];Table[f[n^2],{n,2,40}]
  • PARI
    a(n) = my(k=1); while(!isprime(n^2+k) || !isprime(n^2-k), k++); k; \\ Michel Marcus, May 20 2018
    

Formula

a(n) = A082467(n^2). - Ivan N. Ianakiev, Jul 28 2019

A069360 Number of prime pairs (p,q), p <= q, such that (p+q)/2 = 2*n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Apr 15 2002

Keywords

Comments

The Goldbach conjecture, if true, would imply a(n) > 0.
Row lengths of table A260689, n > 1. - Reinhard Zumkeller, Nov 17 2015

Examples

			n=8: there are 16 pairs (i,j) with (i+j)/2=n*2=16; only two of them, (3,29) and (13,19), consist of primes, therefore a(8)=2.
		

Crossrefs

Bisection of A002375.
Cf. A082467 (least k such that n-k and n+k are both primes), A134677 (records), A134678 (where records occur), A135146 (index of first occurrence of n).

Programs

Formula

For n > 1: a(n) = #{k | 2*n-k and 2*n+k are prime, 1<=k<=2*n}.
a(n) = Sum_{i=3..2n} isprime(i) * isprime(4n-i) * (sign(4n-i) mod 4), n > 1. - Wesley Ivan Hurt, Dec 18 2016

Extensions

Edited by Klaus Brockhaus, Nov 20 2007
a(1)=1, thanks to Charles R Greathouse IV, who noticed this; b-file adjusted.

A264526 Smallest number m such that both 2*n-m and 2*n+m are primes.

Original entry on oeis.org

1, 1, 3, 3, 1, 3, 3, 1, 3, 9, 5, 3, 9, 1, 9, 3, 5, 9, 3, 1, 3, 15, 5, 3, 9, 7, 3, 15, 1, 9, 3, 5, 15, 3, 1, 15, 3, 5, 9, 15, 5, 3, 9, 7, 9, 15, 7, 9, 3, 1, 3, 3, 1, 3, 15, 13, 15, 9, 7, 9, 15, 13, 21, 21, 5, 3, 27, 1, 9, 15, 5, 33, 9, 1, 15, 3, 7, 9, 3, 5
Offset: 2

Views

Author

Reinhard Zumkeller, Nov 17 2015

Keywords

Crossrefs

Programs

  • Haskell
    a264526 = head . a260689_row
    
  • Mathematica
    snm[n_]:=Module[{m=1},While[!PrimeQ[2n-m]||!PrimeQ[2n+m],m=m+2];m]; Array[ snm,90,2] (* Harvey P. Dale, Aug 13 2017, optimized by Ivan N. Ianakiev, Mar 16 2018 *)
  • PARI
    a(n) = {my(m=1); while(!(isprime(2*n-m) && isprime(2*n+m)), m+=2); m;} \\ Michel Marcus, Mar 18 2018

Formula

a(n) = A260689(n,1);
a(A040040(n)) = 1;
a(A014574(n)/2) = 1;
a(A088763(n)) = 3.
a(n) = A082467(2n). - Ivan N. Ianakiev, Oct 27 2021

A075468 Minimal m such that n^n-m and n^n+m are both primes, or -1 if there is no such m.

Original entry on oeis.org

1, 4, 15, 42, 7, 186, 75, 10, 33, 1302, 487, 114, 297, 58, 2253, 1980, 1045, 1638, 1767, 2032, 8067, 10800, 257, 588, 3423, 3334, 5907, 12882, 1213, 12972, 8547, 3644, 7035, 2178, 16747, 24324, 5523, 12628, 2241, 25602, 16495, 41706, 23127, 22376, 24927
Offset: 2

Views

Author

Zak Seidov, Sep 18 2002

Keywords

Comments

n^n is an interprime, the average of two consecutive primes, presumably only for n = 2, 6 and 9. In general n^n may be average of several pairs of primes, in which case the minimal distance is in the sequence. It is not clear (but quite probable) that for all n, n^n is the average of two primes. See also n! and n!! as average of two primes in A075409 and A075410.
n^n -/+ a(n) are both primes, with a(n) being the smallest common distance.

Examples

			a(4)=15 because 4^4=256 and 256 -/+ 15 = 271 and 241 are primes with smallest distance from 4^4; a(23)= 10800 because 23^23 = 20880467999847912034355032910567 and 23^23 -/+ 10800 are two primes with the smallest distance from 23^23.
		

Crossrefs

Programs

  • Mathematica
    fm[n_]:=Module[{n2=n^n,m=1},While[!PrimeQ[n2+m]||!PrimeQ[n2-m],m++];m]; Array[fm,50,2] (* Harvey P. Dale, May 19 2012 *)
  • PARI
    a(n) = my(m=1,nn=n^n); while (! (ispseudoprime(nn-m) && ispseudoprime(nn+m)), m++); m; \\ Michel Marcus, Feb 21 2025

Formula

a(n) = A082467(A000312(n)). - Michel Marcus, Feb 21 2025

Extensions

More terms from Lior Manor, Sep 18 2002
Corrected by Harvey P. Dale, May 19 2012

A115564 Least number d such that 10^n -/+ d form a prime pair.

Original entry on oeis.org

3, 3, 9, 69, 129, 39, 261, 213, 459, 33, 57, 39, 267, 657, 357, 1377, 3, 387, 1899, 393, 213, 651, 3273, 2733, 3423, 1533, 429, 603, 1131, 1137, 1113, 1131, 249, 603, 2979, 159, 429, 921, 1269, 2757, 777, 789, 2277, 11799, 9, 5343, 1821, 6981, 23049, 1623
Offset: 1

Views

Author

Lekraj Beedassy, Mar 11 2006

Keywords

Comments

a(n) == 0 (mod 3). - Robert G. Wilson v, Mar 13 2006

Examples

			a(1)=3 because 10-3=7 and 10+3=13 both of which are primes.
a(3)=9 because 1000-9=991 and 1000+9=1009 both of which are primes.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k;
    for k from 3 by 6 do
        if isprime(10^n+k) and isprime(10^n-k) then return k fi
      od
    end proc:
    map(f, [$1..100]); # Robert Israel, May 25 2018
  • Mathematica
    f[n_] := Block[{k = 1}, While[ ! PrimeQ[10^n - 3k] || ! PrimeQ[10^n + 3k], k++ ]; 3k]; Array[f, 50]
    dpp[n_]:=Module[{n10=10^n,np=NextPrime[10^n],diff},diff=np-n10; While[ !PrimeQ[n10-diff],np=NextPrime[np];diff=np-n10];np-n10]; Array[dpp,80] (* Harvey P. Dale, Mar 28 2012 *)
  • PARI
    { for (n = 1, 80, tenp = 10^n ; p = nextprime(tenp) ; while ( p-tenp < tenp, diff=p-tenp ; if ( isprime(tenp-diff), print1(diff",") ; break ; ) ; p=nextprime(p+1) ; ) ; ) } \\ R. J. Mathar, Mar 15 2006

Formula

a(n) = 3*A117738(n) = A082467(10^n). - Robert Israel, May 25 2018

Extensions

More terms from Craig Baribault (csb166(AT)psu.edu) and Robert G. Wilson v, Mar 13 2006
More terms from R. J. Mathar, Mar 15 2006
Corrected by Harvey P. Dale, Mar 28 2012

A185101 The number n written using the minimum number of terms in the base where the values of the places are 1 and primes (noncomposites). For multiple solutions the smallest binary value is chosen.

Original entry on oeis.org

0, 1, 10, 100, 101, 1000, 1001, 10000, 1100, 10010, 10100, 100000, 11000, 1000000, 100100, 1000010, 101000, 10000000, 110000, 100000000, 1010000, 100000010, 10001000, 1000000000, 1100000, 1000000010, 100010000, 1100100, 10100000, 10000000000
Offset: 0

Views

Author

Frank M Jackson, Jan 23 2012

Keywords

Comments

There are many ways of generating binary vectors a(n) for selecting noncomposites that when summed give n. A007924 uses the greedy algorithm. The above sequence uses the strong Goldbach conjecture that any integer is the sum of at most three distinct summands. It generates a(n) to select the minimum number of distinct noncomposites. Where there are multiple solutions, it chooses the smallest binary vector.

Examples

			n=57 which is > 6 and odd, so m = (nextprime > 57/3) = 23 and n-m = 34 is even, thus A082467(17) = 6 and algorithm selects {23,11,23}. These are not distinct primes, so m = nextprime(nextprime > n/3) = 29 and A082467(14)=3, thus a(n) selects {29,11,17} as the binary vector 10010100000.
		

Crossrefs

Programs

  • Mathematica
    nextprime[j_] := Module[{k}, If[j==0, 1, (k=Floor[j]+1; While[!PrimeQ[k], k++]; k)]]; primetable[n_] := Module[{p, q}, Which[n==1, {0, 2, 0}, n==2, {1, 3, 0}, n==3, {1, 5, 0}, True, (p=n+1; q=2n-p; While[q>0&&!(PrimeQ[p]&&PrimeQ[q]), p++; q--]; {0, q, p})]]; fintable[m_] := Module[{temptable}, Which[m==0, {0, 0, 0}, m==1, {1, 0, 0}, PrimeQ[m], {0, m, 0}, PrimeQ[m-2]&&m>4, {0, 2, m-2}, EvenQ[m], primetable[m/2], True, (temptable=primetable[(m-nextprime[m/3])/2]; If[temptable[[3]]==nextprime[m/3], (temptable=primetable[(m-nextprime[nextprime[m/3]])/2]; temptable[[1]]=nextprime[nextprime[m/3]]), temptable[[1]]=nextprime[m/3]]; temptable)]]; decimal[t_] := Module[{temp2table, tempdecimal=0}, (temp2table=fintable[t]; If[temp2table[[1]]==0, Null, tempdecimal=tempdecimal+2^PrimePi[temp2table[[1]]]]; If[temp2table[[2]]==0, Null, tempdecimal=tempdecimal+2^PrimePi[temp2table[[2]]]]; If[temp2table[[3]]==0, Null, tempdecimal=tempdecimal+2^PrimePi[temp2table[[3]]]];tempdecimal)];Table[IntegerString[decimal[i], 2], {i, 0, 100}]

Formula

For n, 1 to 6, a(n) is manually defined. For n prime, a(n) selects n. For n > 6 and n-2 prime, a(n) selects 2 and n-2. For n > 6 and even, use A082467(n/2) to give k, then a(n) selects n/2+k, n/2-k. For n>6 and odd, let m = (nextprime > n/3), then n-m is even and A082467((n-m)/2) gives k, a(n) selects m, (n-m)/2-k, (n-m)/2+k. If m = (n-m)/2+k, then m = nextprime(nextprime > n/3) and repeat.

Extensions

Name clarified by Frank M Jackson, Oct 08 2013

A143697 Least square k^2 such that n^2-k^2 = p*q with p and q odd primes and p= 4.

Original entry on oeis.org

1, 4, 1, 16, 9, 4, 9, 36, 1, 36, 9, 4, 9, 36, 1, 144, 9, 4, 81, 36, 25, 36, 9, 16, 81, 144, 1, 144, 81, 16, 9, 36, 25, 36, 81, 4, 9, 144, 1, 576, 9, 4, 225, 36, 25, 144, 9, 64, 81, 36, 49, 144, 9, 16, 225, 144, 1, 324, 81, 16, 9, 36, 25, 36, 225, 4, 9, 144, 1, 36, 225
Offset: 4

Views

Author

Pierre CAMI, Aug 29 2008

Keywords

Comments

The product p*q is the sum of p consecutive odd numbers with 2*n-1 the greatest.
For n=4 p*q=3*5=15, 15=7+5+3
For n=5 p*q=3*7=21, 21=9+7+5
For n=6 p*q=5*7=35, 35=11+9+7+5+3
For n=7 p*q=3*11=33, 33=13+11+9
k^2 is the sum of the k first consecutive odd numbers p=n-k and q=n+k.
Assuming a strong version of the Goldbach conjecture, every term exists and we have a(n)=A082467(n)^2, p(n)=A078587(n) and q(n)=A078496(n). [T. D. Noe, Jan 22 2009]

Examples

			4*4-1=3*5 p=3 q=5
5*5-4=3*7 p=3 q=7
6*6-1=5*7 p=5 q=7
7*7-16=3*11 p=3 q=11
		

Crossrefs

Programs

  • PARI
    a(n) = {for (k=1, n-1, my(x=n^2-k^2); if ((omega(x)==2) && (bigomega(x)==2) && (x%2), return(k^2);););} \\ Michel Marcus, Sep 23 2019

A377319 a(n) is the smallest positive integer k such that n + k and n - k have the same number of divisors.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 3, 3, 1, 6, 3, 2, 3, 6, 1, 1, 3, 2, 9, 5, 2, 6, 3, 3, 6, 12, 1, 4, 6, 4, 1, 5, 2, 2, 6, 2, 3, 1, 1, 8, 3, 2, 11, 3, 4, 7, 3, 1, 6, 2, 3, 1, 1, 4, 7, 9, 1, 4, 7, 4, 3, 6, 5, 2, 2, 2, 3, 6, 1, 4, 4, 4, 3, 6, 4, 9, 6, 2, 5, 5, 2, 8, 1, 3, 3, 2, 3
Offset: 4

Views

Author

Felix Huber, Nov 17 2024

Keywords

Comments

If the strong Goldbach conjecture is true, that every even number >= 8 is the sum of two distinct primes, then a positive integer k <= A082467(n) exists for n >= 4.

Examples

			a(8) = 2 because 10 and 6 have both four divisors. 9 and 7 have a different number of divisors.
		

Crossrefs

Programs

  • Maple
    A377319:=proc(n)
       local k;
       for k to n-1 do
          if NumberTheory:-tau(n+k)=NumberTheory:-tau(n-k) then
             return k
          fi
       od;
    end proc;
    seq(A377319(n),n=4..90);
  • Mathematica
    A377319[n_] := Module[{k = 0}, While[DivisorSigma[0, ++k + n] != DivisorSigma[0, n - k]]; k];
    Array[A377319, 100, 4] (* Paolo Xausa, Dec 03 2024 *)
  • PARI
    a(n) = my(k=1); while (numdiv(n+k) != numdiv(n-k), k++); k; \\ Michel Marcus, Nov 17 2024

Formula

1 <= a(n) <= A082467(n).
Previous Showing 11-20 of 28 results. Next