OFFSET
1,2
EXAMPLE
a(2) = prime(1) - floor(a(1)/2) = 2 - floor(1/2) = 2,
a(3) = prime(2) - floor(a(2)/2) = 3 - floor(2/2) = 2,
a(4) = prime(3) - floor(a(3)/2) = 5 - floor(2/2) = 4,
a(5) = prime(4) - floor(a(4)/2) = 7 - floor(4/2) = 5,
a(6) = prime(5) - floor(a(5)/2) = 11 - floor(5/2) = 9.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = Prime[n - 1] - Floor[a[n - 1]/2]; Array[a, 100] (* Amiram Eldar, Sep 24 2020 *)
PROG
(Ruby) require 'prime'
values = [1]
Prime.each(100) { |prime| values << prime - values[-1] / 2 }
p values
(PARI) a(n) = if (n<=2, n, prime(n-1) - floor(a(n-1)/2)); \\ Michel Marcus, Oct 07 2020; corrected Jun 13 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Sep 24 2020
STATUS
approved