%I #53 Sep 16 2022 10:16:07
%S 1,2,5,8,8,8,8,8,17,26,26,15,15,15,15,15,48,48,29,29,29,29,29,29,29,
%T 29,29,29,29,29,29,29,62,95,95,95,95,95,57,57,57,57,57,57,57,57,57,57,
%U 57,57,158,158,158,158,103,48,161,218,218,99,99,99,99,99,35,35,168,100,100,100
%N a(n) = (A005132(2*n-1) + A005132(2*n))/4.
%H Michel Marcus, <a href="/A356870/b356870.txt">Table of n, a(n) for n = 1..10000</a>
%t r[-1] = r[0] = 0; r[n_] := r[n] = If[(d = r[n - 1] - n) >= 0 && FreeQ[Array[r, n, 0], d], d, r[n - 1] + n]; a[n_] := (r[2*n - 1] + r[2*n])/4; Array[a, 100] (* _Amiram Eldar_, Sep 02 2022 *)
%o (PARI) recaman(N)={ my(s, t, v=vector(N)); for(n=1, N, s=bitor(s, 1<<t += if( t<=n || bittest(s, t-n), n, -n)); v[n]=t); v; } \\ adapted from A005132
%o lista(nn) = my(v=recaman(2*nn+2)); vector(nn, k, v[2*k-1] + v[2*k])/4; \\ _Michel Marcus_, Sep 13 2022
%o (Python)
%o from itertools import count, islice
%o def A356870_gen(): # generator of terms
%o b, aset = 0, set()
%o for n in count(1):
%o aset.add(b)
%o a, b = b, c if (c:=b-n)>=0 and c not in aset else b+n
%o if not n&1:
%o yield a+b>>2
%o A356870_list = list(islice(A356870_gen(),30)) # _Chai Wah Wu_, Sep 15 2022
%Y Cf. A005132, A356839.
%K nonn,look
%O 1,2
%A _Paul Curtz_, Sep 02 2022
%E New name, data and offset from _Michel Marcus_, Sep 13 2022