login
This site is supported by donations to The OEIS Foundation.

 

Logo

Many excellent designs for a new banner were submitted. We will use the best of them in rotation.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A064722 a(1) = 0; for n >= 2, a(n) = n - (largest prime <= n). 7
0, 0, 0, 1, 0, 1, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 0, 1, 0, 1, 2, 3 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,9

LINKS

Harry J. Smith, Table of n, a(n) for n=1,...,1000

FORMULA

a(n) = 0 iff n is 1 or a prime.

Computable also as a "commutator": PrimePi[Prime[m]]-Prime[PrimePi[m]]= A000720[A000040(m)]-A000040[A000720(m)]. Labels position of composites between 2 consecutive primes. - Labos Elemer, Oct 19 2001

a(n) = a(n-1)*0^A010051(n) + 1 - A010051(n), a(1) = 0. - Reinhard Zumkeller, Mar 23 2006

EXAMPLE

a(26) = 26 - 23 = 3, a(37) = 37 - 37 = 0.

MATHEMATICA

Join[{0}, Table[n-NextPrime[n+1, -1], {n, 2, 110}]] (* From Harvey P. Dale, Aug 23 2011 *)

PROG

(PARI) { for (n = 1, 1000, if (n>1, a=n - precprime(n), a=0); write("b064722.txt", n, " ", a) ) } [From Harry J. Smith, Sep 23 2009]

CROSSREFS

Equals n - A007917(n).

Cf. A007920

Sequence in context: A123343 A054439 A215151 * A123735 A155839 A229615

Adjacent sequences:  A064719 A064720 A064721 * A064723 A064724 A064725

KEYWORD

nonn

AUTHOR

Reinhard Zumkeller, Oct 13 2001

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified April 20 13:52 EDT 2014. Contains 240806 sequences.