login
A337724
a(n) = prime(n-2) - floor(a(n-2)/2); a(1)=0, a(2)=1.
2
0, 1, 2, 3, 4, 6, 9, 10, 13, 14, 17, 22, 23, 26, 30, 30, 32, 38, 43, 42, 46, 50, 50, 54, 58, 62, 68, 70, 69, 72, 75, 77, 90, 93, 92, 93, 103, 105, 106, 111, 114, 118, 122, 122, 130, 132, 132, 133, 145, 157, 155, 151, 156, 164, 163, 169, 176, 179, 181, 182, 187, 190, 190
OFFSET
1,3
EXAMPLE
a(3) = prime(1) - floor(a(1)/2) = 2 - floor(0/2) = 2,
a(4) = prime(2) - floor(a(2)/2) = 3 - floor(1/2) = 3,
a(5) = prime(3) - floor(a(3)/2) = 5 - floor(2/2) = 4,
a(6) = prime(4) - floor(a(4)/2) = 7 - floor(3/2) = 6,
a(7) = prime(5) - floor(a(5)/2) = 11 - floor(4/2) = 9.
MATHEMATICA
a[1] = 0; a[2] = 1; a[n_] := a[n] = Prime[n - 2] - Floor[a[n - 2]/2]; Array[a, 100] (* Amiram Eldar, Sep 18 2020 *)
PROG
(Ruby) require 'prime'
values = [0, 1]
Prime.each(100) do |prime|
values << prime - values[-2] / 2
end
p values
(PARI) a(n) = if (n<=2, n-1, prime(n-2) - floor(a(n-2)/2)); \\ Michel Marcus, Oct 07 2020
CROSSREFS
Cf. A000040. Similar to A337723 with floor instead of ceiling.
Sequence in context: A051404 A046097 A239580 * A175515 A241241 A260343
KEYWORD
nonn
AUTHOR
Simon Strandgaard, Sep 17 2020
STATUS
approved