cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A187921 Positions k of addition steps in Recamán's sequence where A005132(k-1)<=k.

Original entry on oeis.org

1, 2, 3, 5, 11, 13, 15, 17, 24, 26, 28, 30, 32, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 112, 130, 132, 137, 139, 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
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 17 2011

Keywords

Examples

			a(10)=26: A005132(26-1) = 17 and 17-26<0, hence A005132(26) = 17+26 = 43.
		

Crossrefs

Subsequence of A057165;
A005132(a(n)-1) <= a(n); A005132(a(n)) = A005132(a(n)-1) + a(n);
see A187922 for the other positions of addition steps in A005132.

Programs

  • Haskell
    import Data.Set (Set, singleton, member, insert)
    a187921 n = a187921_list !! (n-1)
    a187921_list = r (singleton 0) 1 0 where
       r :: Set Integer -> Integer -> Integer -> [Integer]
       r s n x | x <= n           = n : r (insert (x+n) s) (n+1) (x+n)
               | (x-n) `member` s = r (insert (x+n) s) (n+1) (x+n)
               | otherwise        = r (insert (x-n) s) (n+1) (x-n)