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 21-27 of 27 results.

A132861 Smallest number at distance 3n from nearest prime (variant 2).

Original entry on oeis.org

2, 26, 53, 532, 211, 1342, 2179, 15704, 16033, 31424, 24281, 31430, 31433, 155960, 58831, 360698, 206699, 370312, 370315, 492170, 1357261, 1357264, 1357267, 2010802, 2010805, 4652428, 12485141, 17051788, 17051791, 17051794, 11117213, 20831416, 10938023, 20831422
Offset: 0

Views

Author

R. J. Mathar, Nov 18 2007

Keywords

Comments

Let f(m) be the distance to the nearest prime as defined in A051700(m). Then a(n) = min {m: f(m) = 3n} for n > 0. A132470 uses A051699(m) to define the distance. a(n) <= A132470(n) because here primes at the start or end of a prime gap of size 3n may be picked, which would be discarded in A132470 for n>0; this gives a chance to minimize m here further than in A132470.

Crossrefs

Programs

  • Maple
    A051700 := proc(m) if m <= 2 then op(m+1,[2,1,1]) ; else min(nextprime(m)-m,m-prevprime(m)) ; fi ; end: a := proc(n) local m ; if n = 0 then RETURN(2); else for m from 0 do if A051700(m) = 3 * n then RETURN(m) ; fi ; od: fi ; end: seq(a(n),n=0..18);
  • Python
    # see link for faster program
    from sympy import prevprime, nextprime
    def A051700(n):
      return [2, 1, 1][n] if n < 3 else min(n-prevprime(n), nextprime(n)-n)
    def a(n):
      if n == 0: return 2
      m = 0
      while A051700(m) != 3*n: m += 1
      return m
    print([a(n) for n in range(13)]) # Michael S. Branicky, Feb 26 2021

Formula

a(n) = min {m : A051700(m) = 3n} for n > 0.
a(n) = A051652(3*n). [From R. J. Mathar, Jul 22 2009]

Extensions

7 more terms from R. J. Mathar, Jul 22 2009
4 more terms from R. J. Mathar, Aug 21 2018
a(30) and beyond and edits from Michael S. Branicky, Feb 26 2021

A160666 Numbers whose distance to the closest prime number is a prime number.

Original entry on oeis.org

0, 9, 15, 21, 25, 26, 27, 33, 34, 35, 39, 45, 49, 50, 51, 55, 56, 57, 63, 64, 65, 69, 75, 76, 77, 81, 85, 86, 87, 91, 92, 94, 95, 99, 105, 111, 115, 116, 118, 120, 122, 124, 125, 129, 133, 134, 135, 141, 142, 144, 146, 147, 153, 154, 155, 159, 160, 161, 165, 169, 170
Offset: 1

Views

Author

Kyle Stern, May 22 2009

Keywords

Comments

Terms n=2..31 are identical to terms n=1..30 of A079364.

Crossrefs

Programs

  • Maple
    isA160666 := proc(n) local ppl,pmi ; if isprime(n) then RETURN(false): elif n =0 then RETURN(true): elif n =1 then RETURN(false): fi; ppl := nextprime(n)-n ; pmi := n-prevprime(n) ; RETURN (isprime(min(ppl,pmi)) ) ; end: for n from 0 to 200 do if isA160666(n) then printf("%d,",n) ; fi; od: # R. J. Mathar, May 25 2009
  • Mathematica
    fQ[n_] := PrimeQ[ Min[ NextPrime[n] - n, n - NextPrime[n, -1]]]; Select[ Range[0, 174], !PrimeQ@ # && fQ@# &] (* Robert G. Wilson v, May 25 2009 *)

Extensions

More terms from R. J. Mathar and Robert G. Wilson v, May 25 2009

A193598 Even numbers k such that r(k) < r(k/2), where r(n) is the distance from n to the nearest prime.

Original entry on oeis.org

2, 18, 30, 42, 52, 54, 66, 68, 70, 78, 90, 98, 100, 102, 110, 112, 114, 126, 128, 130, 138, 150, 152, 162, 172, 174, 182, 190, 198, 210, 222, 230, 232, 234, 236, 238, 240, 242, 244, 250, 258, 268, 270, 282, 284, 286, 290, 292, 294, 306, 308
Offset: 1

Views

Author

Vladimir Shevelev, Jul 31 2011

Keywords

Examples

			18 is in the sequence, since r(18) = 1 < 2 = r(9); 22 is not in the sequence, since r(22) = 1 >= 0 = r(11).
		

Crossrefs

r(n) is A051699.

Programs

  • PARI
    r(n)=min(nextprime(n)-n,n-precprime(n))
    forstep(k=2,1e3,2,if(r(k)Charles R Greathouse IV, Jul 31 2011

A334208 Number of partitions of 2n into two composite parts, (r,s), such that r and s have the same number of primes less than or equal to them.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 1, 0, 1, 0, 1, 2
Offset: 1

Views

Author

Wesley Ivan Hurt, Apr 18 2020

Keywords

Comments

Apparently a(n) = A051699(n) for n>=2. - R. J. Mathar, Apr 22 2020

Examples

			a(9) = 2; 2*9 = 18 has two partitions into composite parts, (10,8) and (9,9), such that pi(10) = 4 = pi(8) and pi(9) = 4 = pi(9).
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[KroneckerDelta[PrimePi[i], PrimePi[2 n - i]] (1 - PrimePi[i] + PrimePi[i - 1]) (1 - PrimePi[2 n - i] + PrimePi[2 n - i - 1]), {i, 2, n}], {n, 100}]
  • PARI
    A334208(n) = sum(i=2,n,(!isprime(i) && !isprime(n+n-i) && primepi(i)==primepi(n+n-i))); \\ Antti Karttunen, Jan 29 2025

Formula

a(n) = Sum_{i=2..n} [pi(i) = pi(2*n-i)] * (1 - c(i)) * (1 - c(2*n-i)), where [] is the Iverson bracket, pi is the prime counting function (A000720), and c is the prime characteristic (A010051).

Extensions

Data section extended to a(105) by Antti Karttunen, Jan 29 2025

A079582 Least positive k such that the distance from k to closest prime = n.

Original entry on oeis.org

2, 1, 9, 26, 93, 118, 119, 120, 531, 532, 897, 1140, 1339, 1340, 1341, 1342, 1343, 1344, 9569, 15702, 15703, 15704, 15705, 19632, 19633, 19634, 19635, 31424, 31425, 31426, 31427, 31428, 31429, 31430, 31431, 31432, 31433, 155958, 155959, 155960, 155961
Offset: 0

Views

Author

Benoit Cloitre, Jan 26 2003

Keywords

Comments

This sequence only differs from A077019 for n = 2: a(2) = 9 whereas A077019(2) = 0. - Rémy Sigrist, Dec 19 2019

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{s = 1}, While[ PrimeQ[s] || Min[s - NextPrime[s, -1], NextPrime[s] - s] != n, s++ ]; s]; a[0] = 2; Table[a[n], {n, 0, 40}]
  • PARI
    a(n)=if(n<0,0,s=1; while(abs(n-min(abs(precprime(s)-s),abs(nextprime(s)-s)))>0,s++); s)

Extensions

More terms from Robert G. Wilson v, Jan 27 2003
Name clarified by Rémy Sigrist, Dec 19 2019

A079669 a(n) = least k such that the distance from Fibonacci(k) to the closest prime is n, or -1 if no such k exists.

Original entry on oeis.org

3, 1, 0, 9, 16, 12, 37, 42, 149, 33, 26, 27, 38, 24, 28, 189, 44, 111, 50, 66, 49, 57, 68, 30, 46, 81, 142, 78, 92, 96, 59, 69, 71, 141, 184, 267, 67, 129, 61, 117, 211, 576, 115, 372, 161, 138, 119, 198
Offset: 0

Views

Author

Benoit Cloitre, Jan 26 2003

Keywords

Crossrefs

Programs

  • PARI
    a(n)=if(n<0,0,s=1; while(abs(n-min(abs(precprime(fibonacci(s))-fibonacci(s)),abs(nextprime(fibonacci(s))-fibonacci(s))))>0,s++); s)

Extensions

Changed "was found" to "exists" in definition. Offset was wrong. Adjusted initial terms. - N. J. A. Sloane, Jan 29 2022

A242561 a(0)=0; thereafter, a(n) is n multiplied by the distance of a(n-1) to the nearest prime.

Original entry on oeis.org

0, 2, 0, 6, 4, 5, 0, 14, 8, 9, 20, 11, 0, 26, 42, 15, 32, 17, 0, 38, 20, 21, 44, 23, 0, 50, 78, 27, 56, 87, 60, 31, 0, 66, 34, 105, 72, 37, 0, 78, 40, 41, 0, 86, 132, 45, 92, 141, 96, 49, 100, 51, 104, 53, 0, 110, 56, 171, 116, 177
Offset: 0

Views

Author

J. M. Bergot, May 17 2014

Keywords

Comments

It appears that any starting value a(0) will produce a sequence which merges with this one at some point.
Also, if we create a new sequence, call it b(n), from this one by changing one term, say a(k), then it appears that there exists an index m such that a(n)=b(n) for all n>=m. For example, if we replace a(10) by 1341, which is a number within the prime gap 1327-1361, then this new sequence has b(17)=a(17) and so the two sequences agree after that point. - J. M. Bergot, May 21 2014.

Examples

			The sequence begins with a(0)=0, so |2-0|=2 and a(1)=1*2=2; find
the next m=|2-2|=0, so a(2)=0*2=0; find the next m=|2-0|=2, so a(3)=3*2=6; find the next m=|7-6|=1, so a(4)=1*4=4.
		

Formula

a(n+1) = n*A051699(a(n)), starting a(0)=0.

Extensions

Edited by N. J. A. Sloane, May 20 2014
Previous Showing 21-27 of 27 results.