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!)
A033556 a(n+1) = 2a(n) - {largest prime < a(n)}. 1

%I #24 Oct 22 2017 01:34:55

%S 3,4,5,7,9,11,15,17,21,23,27,31,33,35,39,41,45,47,51,55,57,61,63,65,

%T 69,71,75,77,81,83,87,91,93,97,105,107,111,113,117,121,129,131,135,

%U 139,141,143,147,155,159,161,165

%N a(n+1) = 2a(n) - {largest prime < a(n)}.

%H Reinhard Zumkeller, <a href="/A033556/b033556.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n+1) = 2*a(n) - A151799(a(n)). - _Reinhard Zumkeller_, Jul 26 2012

%t a[n_] := a[n] = 2*a[n-1] - NextPrime[ a[n-1], -1]; a[0] = 3; Table[ a[n], {n, 0, 50}] (* _Jean-François Alcover_, Sep 24 2012 *)

%t NestList[2#-NextPrime[#,-1]&,3,50] (* _Harvey P. Dale_, Jul 19 2014 *)

%o (Haskell)

%o a033556 n = a033556_list !! n

%o a033556_list = iterate (\x -> 2*x - fromInteger (a151799 x)) 3

%o -- _Reinhard Zumkeller_, Jul 26 2012

%o (PARI) a(n) = if(n==0,3,2*a(n-1)-precprime(a(n-1)-1)) \\ _Iain Fox_, Oct 18 2017

%o (PARI) first(n) = my(res = vector(n)); res[1] = 3; for(i = 2, n, res[i] = 2 * res[i - 1] - precprime(res[i - 1] - 1)); res \\ _David A. Corneth_, Oct 18 2017

%Y Cf. A007917, A151799.

%K nonn,easy,nice

%O 0,1

%A armand turpel (armand_t(AT)yahoo.com)

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 24 09:18 EDT 2024. Contains 371935 sequences. (Running on oeis4.)