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-4 of 4 results.

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

A077446 Numbers k such that 2*k^2 + 14 is a square.

Original entry on oeis.org

1, 5, 11, 31, 65, 181, 379, 1055, 2209, 6149, 12875, 35839, 75041, 208885, 437371, 1217471, 2549185, 7095941, 14857739, 41358175, 86597249, 241053109, 504725755, 1404960479, 2941757281, 8188709765, 17145817931, 47727298111
Offset: 1

Views

Author

Gregory V. Richardson, Nov 09 2002

Keywords

Comments

The equation "2*n^2 + 14 is a square" is a version of the generalized Pell Equation x^2 - D*y^2 = C where x^2 - 2*y^2 = 14.
Numbers n such that (ceiling(sqrt(n*n/2)))^2 = (7+n^2)/2. - Ctibor O. Zizka, Nov 09 2009
From Wolfdieter Lang, Feb 26 2015: (Start)
This sequence gives all positive solutions x = a(n+1), n >= 0, of the Pell equation x^2 - 2*y^2 = -7. For the corresponding y-solutions see y(n) = 2*A006452(n+2) = A077447(n+1)/2. This implies that X^2 - 2*Y^2 = 14 has the general solutions (X(n),Y(n)) = (2*y(n), x(n)). See the first comment above.
For the positive first class solutions see (A054490(n), 2*A038723(n)) and for the second class solutions (A255236(n), 2*A038725(n+1)). (End)
For n > 0, a(n) is the n-th almost Lucas-balancing number of second type (see Tekcan and Erdem). - Stefano Spezia, Nov 26 2022

Examples

			n = 3: (A077447(3))^2 - 2*a(3)^2 = 16^2 - 2*11^2  = 14;
a(3)^2 - 2*(2*A006452(3+1))^2 = 11^2 - 2*(2*4)^2 = -7. - _Wolfdieter Lang_, Feb 26 2015
		

References

  • A. H. Beiler, "The Pellian." Ch. 22 in Recreations in the Theory of Numbers: The Queen of Mathematics Entertains. Dover, New York, New York, pp. 248-268, 1966.
  • L. E. Dickson, History of the Theory of Numbers, Vol. II, Diophantine Analysis. AMS Chelsea Publishing, Providence, Rhode Island, 1999, pp. 341-400.
  • Peter G. L. Dirichlet, Lectures on Number Theory (History of Mathematics Source Series, V. 16); American Mathematical Society, Providence, Rhode Island, 1999, pp. 139-147.

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{0,6,0,-1},{1,5,11,31},50] (* Sture Sjöstedt, Oct 08 2012 *)

Formula

2*(a(n))^2 + 14 = (A077447(n))^2.
Lim. n-> Inf. a(n)/a(n-2) = 5.8284271247461... = 3 + 2*sqrt(2) = A156035 = RG (Great Ratio).
Lim. k-> Inf. a(2*k+1)/a(2*k) = 2.09383632135605... = (9 + 4*sqrt(2))/7 = A156649 = R1 (Ratio 1).
Lim. k -> Inf. a(2*k)/a(2*k-1) = 2.78361162489122432754 = (11 + 6*sqrt(2))/7 = R2 (Ratio 2); RG = R1*R2.
a(2*k-1) = [ 2*[(3+2*Sqrt(2))^n - (3-2*Sqrt(2))^n] - [(3+2*Sqrt(2))^(n-1) - (3-2*Sqrt(2))^(n-1)] + [(3+2*Sqrt(2))^(n-2) - (3-2*Sqrt(2))^(n-2)] ] / (4*Sqrt(2)) a(2*k) = [ 5*[(3+2*Sqrt(2))^n - (3-2*Sqrt(2))^n] + [(3+2*Sqrt(2))^(n-1) - (3-2*Sqrt(2))^(n-1)] ] / (4*Sqrt(2)).
a(n) = 6*a(n-2) - a(n-4).
G.f.: x*(1+x)*(x^2+4*x+1) / ( (x^2+2*x-1)*(x^2-2*x-1) ). - R. J. Mathar, Jul 03 2011
a(n) = 6*a(n-2) - a(n-4) with a(1)=1, a(2)=5, a(3)=11, a(4)=31. - Sture Sjöstedt, Oct 08 2012
Bisection: a(2*k+1) = S(k, 6) + 5*S(k-1, 6), a(2*k) = 5*S(k-1, 6) + S(k-2, 6), with the Chebyshev polynomials S(n, x) (A049310) with S(-2, x) = -1, S(-1, x) = 0, evaluated at x = 6. S(n, 6) = A001109(n+1). See A054490 and A255236, and the given g.f.s. - Wolfdieter Lang, Feb 26 2015
E.g.f.: 1 - cosh(sqrt(2)*x)*(cosh(x) - 3*sinh(x)) - sqrt(2)*(cosh(x) - 2*sinh(x))*sinh(sqrt(2)*x). - Stefano Spezia, Nov 26 2022
a(n) = a(n-1) + 2*A217975(n-1) + A123335(n-2) - A123335(n-3) for n > 1 and with A123335(-1) = 1. - Vladimir Pletser, Aug 30 2025

A155764 Records in A047160.

Original entry on oeis.org

0, 1, 3, 9, 15, 18, 21, 27, 33, 39, 42, 45, 48, 75, 87, 93, 117, 120, 135, 138, 168, 183, 210, 228, 300, 333, 369, 393, 453, 525, 621, 720, 810, 846, 1086, 1281, 1305, 1515, 1590, 1617, 1722, 1794, 1833, 1851, 2010, 2064, 2085, 2112, 2217, 2352, 2754, 2784
Offset: 1

Views

Author

T. D. Noe, Jan 27 2009

Keywords

Comments

Other than a(2)=1, every known term is a multiple of three. Equivalently, assuming A155765(n) - a(n) != 3, no term of A155765 is a multiple of three. - Jason Kimberley, Oct 24 2012
Conjecture 1: a(n) < 0.138*log(A155765(n))^3.6 for n > 4. Conjecture 2: If Conjecture 1 and Goldbach's conjecture hold, for any integer m > 22, there exist at least one pairs of primes m-d and m+d such that d < 0.138*log(m)^3.6. - Ya-Ping Lu, Nov 27 2020

Crossrefs

Cf. A155765 (where records occur in A047160).

Programs

  • Mathematica
    mgppp[n_?EvenQ]/;n>3:=Block[{m=PrimePi[n/2],p},While[!PrimeQ[n-(p=Prime[m])],m--];p];
    dist[n_?EvenQ]:=Module[{d},{m=n/2,d=(m-mgppp[n])};d]
    For[n=4;a=-1,True,n+=2,b=dist[n];If[b>a,Print[b];a=b]]
    (* Gilmar Rodriguez Pierluissi, Aug 27 2018 *)
  • Python
    from sympy import isprime
    a_rec = -1
    m = 2
    while 1:
        a = 0
        while a < m - 1:
            if isprime(m-a) == 1 and isprime(m+a) == 1:
                if a > a_rec:
                    print(a)
                    a_rec = a
                break
            a += 1
    m += 1 # Ya-Ping Lu, Nov 27 2020

Formula

a(n) = A047160(A155765(n)). - Jason Kimberley, Sep 01 2011

A210700 A047160(3n): smallest m >= 0 with both 3n - m and 3n + m prime.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 5, 4, 1, 4, 5, 2, 1, 2, 5, 8, 7, 4, 1, 4, 5, 2, 1, 4, 5, 2, 5, 14, 7, 4, 7, 2, 1, 2, 1, 2, 13, 10, 7, 14, 13, 2, 5, 4, 1, 10, 5, 10, 1, 4, 7, 8, 5, 2, 5, 8, 7, 4, 1, 10, 5, 8, 1, 2, 1, 10, 7, 16, 13, 14, 17, 8, 11, 2, 1, 2, 5, 4, 1, 14, 5
Offset: 1

Views

Author

Jason Kimberley, Oct 15 2012

Keywords

Comments

This sequence is interesting because, apart from a(2)=1, A155764 appears to consist only of multiples of three. Equivalently, since n and A047160(n) are coprime (for nonzero A047160(n)), no multiple of three appears to occur in A155765.

Crossrefs

Cf. A210701 (location of records in this sequence), A210702 (records in this sequence).

Programs

  • Mathematica
    sml[n_]:=Module[{m=0},While[!PrimeQ[3n-m]||!PrimeQ[3n+m],m++];m]; Array[ sml,100] (* Harvey P. Dale, Sep 23 2022 *)
Showing 1-4 of 4 results.