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

A309913 Distance from n to closest squarefree number that is different from n.

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Aug 22 2019

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = 1}, While[! SquareFreeQ[n + k] && ! SquareFreeQ[n - k], k++]; k]; Table[a[n], {n, 0, 100}]

A341827 a(n) is the distance from n to its more distant neighboring prime.

Original entry on oeis.org

2, 1, 2, 1, 4, 3, 2, 3, 4, 1, 4, 3, 2, 3, 4, 1, 4, 3, 2, 3, 6, 5, 4, 3, 4, 5, 6, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 4, 1, 4, 3, 2, 3, 6, 5, 4, 3, 4, 5, 6, 5, 4, 3, 4, 5, 6, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 4, 1, 6, 5, 4, 3, 4, 5, 6, 3, 2, 3, 6, 5, 4, 3, 4, 5, 8
Offset: 3

Views

Author

Ya-Ping Lu, Feb 20 2021

Keywords

Comments

a(n) is even if n is odd and vice versa. It seems that all records are even.
n - 1 and n + 1 are twin primes if a(n) = 1.
n - 2 and n + 2 are cousin primes for n > 3 if a(n) = 2.
n - 3 and n + 3 are sexy primes if a(n) = A051700(n) = 3.

Crossrefs

Programs

  • Mathematica
    Array[Max[#1 - #2, #3 - #1] & @@ Prepend[NextPrime[#, {-1, 1}], #] &, 105, 3] (* Michael De Vlieger, Mar 17 2021 *)
  • PARI
    for(n=3,88,my(d1=n-precprime(n-1),d2=nextprime(n+1)-n);print1(max(d1,d2),", ")) \\ Hugo Pfoertner, Mar 10 2021
  • Python
    from sympy import prevprime, nextprime
    for n in range(3, 1001):
        prevp = prevprime(n); nextp = nextprime(n)
        print(max(n - prevp, nextp - n))
    

Formula

a(n) = max{n - prevprime(n), nextprime(n) - n}.
Previous Showing 11-12 of 12 results.