The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A049711 a(n) = n - prevprime(n). 33

%I #26 Aug 04 2022 05:51:57

%S 1,1,2,1,2,1,2,3,4,1,2,1,2,3,4,1,2,1,2,3,4,1,2,3,4,5,6,1,2,1,2,3,4,5,

%T 6,1,2,3,4,1,2,1,2,3,4,1,2,3,4,5,6,1,2,3,4,5,6,1,2,1,2,3,4,5,6,1,2,3,

%U 4,1,2,1,2,3,4,5,6,1,2,3,4,1,2,3,4,5,6,1,2,3,4,5,6

%N a(n) = n - prevprime(n).

%C All runs end in even numbers at a(p), new highs are found at A000101 and the increasing gap size is A005250. - _Robert G. Wilson v_, Dec 07 2001

%C All terms are positive since here the variant 2 (A151799(n) < n) of the prevprime function is used, rather than the variant 1 (A007917(n) <= n). - _M. F. Hasler_, Sep 09 2015

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

%p A049711 := n-> n-prevprime(n);

%t PrevPrim[n_] := Block[ {k = n - 1}, While[ !PrimeQ[k], k-- ]; Return[k]]; Table[ n - PrevPrim[n], {n, 3, 100} ]

%t Array[#-NextPrime[#,-1]&,100,3] (* _Harvey P. Dale_, Dec 07 2011 *)

%o (PARI) A049711(n)=n-precprime(n-1) \\ _M. F. Hasler_, Sep 09 2015

%Y Cf. A000101, A005250, A049613, A049653, A049716, A049847, A064722.

%Y Cf. A151799, A007917.

%Y Cf. A175851.

%K nonn

%O 3,3

%A _N. J. A. Sloane_

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 June 8 17:25 EDT 2024. Contains 373224 sequences. (Running on oeis4.)