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

%I #28 May 13 2022 17:28:52

%S 0,1,2,2,4,6,9,10,12,14,17,22,22,26,30,30,32,38,43,42,45,50,50,54,58,

%T 62,68,70,69,72,74,77,90,92,92,93,103,104,105,111,114,117,122,122,130,

%U 132,132,133,145,156,154,151,156,163,163,169,175,178,181,182,186,190,190

%N a(n) = prime(n-2) - ceiling(a(n-2)/2); a(1)=0, a(2)=1.

%H Harvey P. Dale, <a href="/A337723/b337723.txt">Table of n, a(n) for n = 1..1000</a>

%e a(3) = prime(1) - ceiling(a(1)/2) = 2 - ceiling(0/2) = 2,

%e a(4) = prime(2) - ceiling(a(2)/2) = 3 - ceiling(1/2) = 2,

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

%e a(6) = prime(4) - ceiling(a(4)/2) = 7 - ceiling(2/2) = 6,

%e a(7) = prime(5) - ceiling(a(5)/2) = 11 - ceiling(4/2) = 9.

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

%t nxt[{n_,a_,b_}]:={n+1,b,Prime[n-1]-Ceiling[a/2]}; Join[{0,1,2},Drop[NestList[nxt,{3,2,2},70][[All,2]],2]] (* _Harvey P. Dale_, May 13 2022 *)

%o (Ruby) require 'prime'

%o values = [0, 1]

%o Prime.each(100) do |prime|

%o values << prime - (values[-2]+1) / 2

%o end

%o p values

%o (PARI) a(n) = if (n<=2, n-1, prime(n-2) - ceil(a(n-2)/2)); \\ _Michel Marcus_, Oct 07 2020

%Y Cf. A000040. Similar to A337724 with ceiling instead of floor.

%K nonn

%O 1,3

%A _Simon Strandgaard_, Sep 17 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 April 23 03:30 EDT 2024. Contains 371906 sequences. (Running on oeis4.)