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.

A047973 Distance of n-th prime to nearest cube.

Original entry on oeis.org

1, 2, 3, 1, 3, 5, 9, 8, 4, 2, 4, 10, 14, 16, 17, 11, 5, 3, 3, 7, 9, 15, 19, 25, 28, 24, 22, 18, 16, 12, 2, 6, 12, 14, 24, 26, 32, 38, 42, 43, 37, 35, 25, 23, 19, 17, 5, 7, 11, 13, 17, 23, 25, 35, 41, 47, 53, 55, 61, 62, 60, 50, 36, 32, 30, 26, 12, 6, 4, 6, 10, 16, 24, 30, 36, 40
Offset: 1

Views

Author

Keywords

Examples

			For 179, 125 is the preceding cube, 216 is the succeeding. 179-125 = 54, 216-179 = 37, so the distance is 37.
		

Crossrefs

Cf. A047972.

Programs

  • Mathematica
    dnc[n_]:=Module[{c=Surd[n,3]},Min[Ceiling[c]^3-n,n-Floor[c]^3]]; dnc/@ Prime[Range[80]] (* Harvey P. Dale, Jan 11 2017 *)
  • PARI
    a(n) = {p = prime(n); sc = sqrtnint(p, 3); min(p - sc^3, (sc+1)^3 - p);} \\ Michel Marcus, Jun 05 2014

Formula

For each prime, find the closest cube (preceding or succeeding); subtract, take absolute value.

A131866 Distance of n-th semiprime to nearest square.

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Oct 04 2007

Keywords

Comments

This to semiprimes A001358 as A047972 is to primes A000040.
For each semiprime, find the closest square (preceding or succeeding); subtract, take absolute value.

Examples

			a(1) = 0 because the first semiprime is 4, which is a square.
a(2) = 2 because the 2nd semiprime is 6 and |6-4| = 2 where 4 is the nearest square to 6.
a(3) = 0 because the 3rd semiprime is 9, which is a square.
a(4) = 1 because the 4th semiprime is 10 and |10-9| = 1 where 9 is the nearest square to 10.
		

Crossrefs

Programs

  • Mathematica
    dns[n_]:=Min[n-Floor[Sqrt[n]]^2,Ceiling[Sqrt[n]]^2-n]; dns/@Select[ Range[ 400],PrimeOmega[#]==2&] (* Harvey P. Dale, Aug 12 2016 *)

Formula

a(n)=A053188(A001358(n)) (corrected by R. J. Mathar, Nov 19 2007).

Extensions

More terms from R. J. Mathar, Oct 24 2007

A301630 a(n) = distance of n-th prime to nearest prime power p^k, k=0 and k >= 2 (A025475).

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 1, 3, 2, 2, 1, 5, 8, 6, 2, 4, 5, 3, 3, 7, 8, 2, 2, 8, 16, 20, 18, 14, 12, 8, 1, 3, 9, 11, 20, 18, 12, 6, 2, 4, 10, 12, 22, 24, 28, 30, 32, 20, 16, 14, 10, 4, 2, 5, 1, 7, 13, 15, 12, 8, 6, 4, 18, 22, 24, 26, 12, 6, 4, 6, 8, 2, 6, 12, 18, 22, 28, 36, 40, 48, 58, 60, 70, 72, 73, 69, 63, 55
Offset: 1

Views

Author

Altug Alkan, Mar 24 2018

Keywords

Examples

			a(9) = a(10) = 2 because 5^2 is the nearest prime power (A025475) to prime(9) = 23 and 3^3 is the nearest prime power (A025475) to prime(10) = 29.
		

Crossrefs

There are four different sequences which may legitimately be called "prime powers": A000961 (p^k, k >= 0), A246655 (p^k, k >= 1), A246547 (p^k, k >= 2), A025475 (p^k, k=0 and k >= 2).

Programs

  • Maple
    Primes:= select(isprime, [2,seq(i,i=3..1000,2)]):
    Ppows:= sort([1,seq(seq(p^j, j=2..floor(log[p](1000))),p=Primes)]):
    for n from 1 while Primes[n] < Ppows[-1] do
      i:= ListTools:-BinaryPlace(Ppows,Primes[n]);
      A[n]:= min(Primes[n]-Ppows[i],Ppows[i+1]-Primes[n])
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Mar 26 2018
  • PARI
    isA025475(n) = {isprimepower(n) && !isprime(n) || n==1}
    a(n) = {my(k=1, p=prime(n)); while(!isA025475(p+k) && !isA025475(p-k), k++); k; }

Formula

a(n) = A061670(A000040(n)).

A249077 Primes of the form n^2 + k such that n^2 - k is also prime, where -n < k < n.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 31, 41, 61, 67, 73, 79, 83, 89, 97, 103, 137, 139, 149, 151, 157, 181, 193, 199, 211, 223, 227, 239, 241, 271, 311, 317, 331, 337, 349, 373, 421, 433, 439, 443, 449, 461, 607, 619, 631, 643, 661, 691, 719, 739, 757, 811, 823, 829, 853, 859
Offset: 1

Views

Author

Arkadiusz Wesolowski, Oct 20 2014

Keywords

Comments

Members of a pair (a, b) of primes such that a < b and the distances from a and b to the nearest square above a (or below b) are equal.
The only prime of the form n^2 + 1 (A002496) in the sequence is 5.
Is this sequence infinite?

Examples

			2^2-1=3, 2^2+1=5, both prime.
8^2-3=61, 8^2+3=67, both prime.
		

Crossrefs

Programs

  • Magma
    lst:=[]; for m in [1..28] do r:=m*(m+1)+1; s:=(m+1)^2; for a in [r..s-1] do if IsPrime(a) then b:=2*s-a; if IsPrime(b) then Append(~lst, a); Append(~lst, b); end if; end if; end for; end for; Sort(lst);
    
  • Maple
    g:= proc(t,m) if isprime(m+t) and isprime(m-t) then (m+t,m-t) else NULL fi end proc:
    `union`(seq(map(g,{$1..n-1},n^2),n=2..100));
    # if using Maple 11 or earlier, uncomment the next line
    # sort(convert(%,list));
    # Robert Israel, Oct 31 2014
  • PARI
    for(n=1, 859, if(issquare(n), x=ps=n; until(issquare(x), x++); ns=x); if(isprime(n), if(n-ps
    				

Formula

A prime p is in the sequence if and only if 2*A053187(p)-p is prime.
Showing 1-4 of 4 results.