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!)
A337823 a(n) = prime(n-1) - floor(a(n-1)/2); a(1)=1. 0

%I #17 Jun 13 2022 03:01:47

%S 1,2,2,4,5,9,9,13,13,17,21,21,27,28,29,33,37,41,41,47,48,49,55,56,61,

%T 67,68,69,73,73,77,89,87,94,92,103,100,107,110,112,117,121,121,131,

%U 128,133,133,145,151,152,153,157,161,161,171,172,177,181,181,187

%N a(n) = prime(n-1) - floor(a(n-1)/2); a(1)=1.

%e a(2) = prime(1) - floor(a(1)/2) = 2 - floor(1/2) = 2,

%e a(3) = prime(2) - floor(a(2)/2) = 3 - floor(2/2) = 2,

%e a(4) = prime(3) - floor(a(3)/2) = 5 - floor(2/2) = 4,

%e a(5) = prime(4) - floor(a(4)/2) = 7 - floor(4/2) = 5,

%e a(6) = prime(5) - floor(a(5)/2) = 11 - floor(5/2) = 9.

%t a[1] = 1; a[n_] := a[n] = Prime[n - 1] - Floor[a[n - 1]/2]; Array[a, 100] (* _Amiram Eldar_, Sep 24 2020 *)

%o (Ruby) require 'prime'

%o values = [1]

%o Prime.each(100) { |prime| values << prime - values[-1] / 2 }

%o p values

%o (PARI) a(n) = if (n<=2, n, prime(n-1) - floor(a(n-1)/2)); \\ _Michel Marcus_, Oct 07 2020; corrected Jun 13 2022

%Y Cf. A000040. Similar to A337724 that has step size 2, instead of 1 here.

%K nonn

%O 1,2

%A _Simon Strandgaard_, Sep 24 2020

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 6 19:21 EDT 2024. Contains 373134 sequences. (Running on oeis4.)