%I #15 May 01 2020 22:15:34
%S 1,2,3,5,11,13,15,17,24,26,28,30,32,39,41,43,45,47,49,51,53,55,57,59,
%T 61,63,65,78,80,82,84,86,88,90,92,94,96,98,100,112,130,132,137,139,
%U 141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,197,199,201,203,205,207,209,211,213,215,217,219,221,223,248,250
%N Positions k of addition steps in Recamán's sequence where A005132(k-1)<=k.
%H Reinhard Zumkeller, <a href="/A187921/b187921.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%e a(10)=26: A005132(26-1) = 17 and 17-26<0, hence A005132(26) = 17+26 = 43.
%o (Haskell)
%o import Data.Set (Set, singleton, member, insert)
%o a187921 n = a187921_list !! (n-1)
%o a187921_list = r (singleton 0) 1 0 where
%o r :: Set Integer -> Integer -> Integer -> [Integer]
%o r s n x | x <= n = n : r (insert (x+n) s) (n+1) (x+n)
%o | (x-n) `member` s = r (insert (x+n) s) (n+1) (x+n)
%o | otherwise = r (insert (x-n) s) (n+1) (x-n)
%Y Subsequence of A057165;
%Y A005132(a(n)-1) <= a(n); A005132(a(n)) = A005132(a(n)-1) + a(n);
%Y see A187922 for the other positions of addition steps in A005132.
%K nonn
%O 1,2
%A _Reinhard Zumkeller_, Mar 17 2011
|