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

A072681 a(n) = (n - A007917(n)) * (A007918(n) - n).

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 1, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 5, 8, 9, 8, 5, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 1, 0, 5, 8, 9, 8, 5, 0, 3, 4, 3, 0, 5, 8, 9, 8, 5, 0, 7, 12, 15, 16, 15, 12, 7, 0, 3, 4, 3, 0, 1, 0
Offset: 2

Views

Author

Reinhard Zumkeller, Jul 01 2002

Keywords

Comments

a(n)=0 iff n is prime.
Local maxima occur at interprimes: a(A024675(n)) = A074927(n+1). - Reinhard Zumkeller, Mar 04 2009
Expanding upon the maxima comment, repetitive subset triplets (like 3,4,3) of form (k,k+1,k) occur when the middle value is a square. - Bill McEachen, Apr 14 2025

Crossrefs

Programs

  • Mathematica
    a[n_] := (n - NextPrime[n+1, -1])*(NextPrime[n] - n); Table[a[n], {n, 2, 103}] (* Jean-François Alcover, Jun 14 2013 *)

Formula

a(n) = A064722(n) * A007920(n).
a(n) = A064722(n) * (A072680(n) - A064722(n)).

A097106 a(n) = (Smallest prime power >= n) - (greatest prime power <= n).

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Sep 15 2004

Keywords

Crossrefs

Programs

  • Mathematica
    sp[n_] := If[n == 1, 1, Module[{m = n}, While[!PrimePowerQ[m], m++]; m]];
    gp[n_] := If[n == 1, 1, Module[{m = n}, While[!PrimePowerQ[m], m--]; m]];
    a[n_] := sp[n] - gp[n];
    Array[a, 100] (* Jean-François Alcover, Dec 02 2021 *)
  • PARI
    A000015(n) = if(1==n, n, while(!isprimepower(n), n++); n);
    A031218(n) = if(1==n, n, while(!isprimepower(n), n--); n);
    A097106(n) = (A000015(n) - A031218(n)); \\ Antti Karttunen, Sep 23 2018

Formula

a(n) = A000015(n) - A031218(n);
a(n) = 0 iff n is a power of a prime (in A000961).

A329273 a(1)=1. If n is prime, a(n)=0; if not, a(n) = (the smallest prime number greater than n) minus (the largest prime number smaller than n) minus 1.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 1, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 1, 0, 5, 5, 5, 5, 5, 0, 3, 3, 3, 0, 5, 5, 5, 5, 5, 0, 7, 7, 7, 7, 7, 7, 7, 0, 3, 3, 3
Offset: 1

Views

Author

Todor Szimeonov, Nov 11 2019

Keywords

Comments

When n is not a prime number, a(n) expresses the size of the prime gap to which n belongs.

Examples

			Let n=9. The smallest prime number, greater than 9 is 11, the largest prime number, smaller than 9 is 7. a(9)=11-7-1=3.
		

Crossrefs

Programs

  • Mathematica
    Array[Which[# == 1, 1, PrimeQ@ #, 0, True, Prime[# + 1] - Prime@ # - 1 &@ PrimePi@ #] &, 105] (* Michael De Vlieger, Nov 18 2019 *)
  • PARI
    a(n) = if (n==1, 1, if (isprime(n), 0, nextprime(n+1) - precprime(n-1) - 1)); \\ Michel Marcus, Dec 01 2019

Formula

a(1)=1. If n is prime, a(n)=0; if not, a(n) = nextprime(n) - precprime(n) - 1.
The nonzero terms are one less than the nonzero terms of A072680. More precisely, a(n) = A072680(n) - sign(A072680(n)) for n > 1. - Rémy Sigrist, Nov 30 2019
Showing 1-3 of 3 results.