login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A064722 a(1) = 0; for n >= 2, a(n) = n - (largest prime <= n). 17

%I #27 Aug 04 2022 05:52:09

%S 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,

%T 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,

%U 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

%N a(1) = 0; for n >= 2, a(n) = n - (largest prime <= n).

%H Harry J. Smith, <a href="/A064722/b064722.txt">Table of n, a(n) for n=1..1000</a>

%F a(n) = n - A007917(n).

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

%F Computable also as a "commutator": pi(prime(m)) - prime(pi(m)) = A000720(A000040(m)]-A000040(A000720(m)). Labels position of composites between 2 consecutive primes. - _Labos Elemer_, Oct 19 2001

%F a(n) = a(n-1)*0^A010051(n) + 1 - A010051(n), a(1) = 0. - _Reinhard Zumkeller_, Mar 23 2006

%F a(n) = n mod A007917(n). - _Michel Marcus_, Aug 22 2014

%F a(n) = A049711(n+1) - 1 for n >= 2. - _Pontus von Brömssen_, Jul 31 2022

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

%p 0, seq(n - prevprime(n+1), n=2..100); # _Robert Israel_, Aug 25 2014

%t Join[{0},Table[n-NextPrime[n+1,-1],{n,2,110}]] (* _Harvey P. Dale_, Aug 23 2011 *)

%o (PARI) { for (n = 1, 1000, if (n>1, a=n - precprime(n), a=0); write("b064722.txt", n, " ", a) ) } \\ _Harry J. Smith_, Sep 23 2009

%Y Cf. A000040, A000720, A007917, A007920, A010051, A049711.

%K nonn

%O 1,9

%A _Reinhard Zumkeller_, Oct 13 2001

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)