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.

A118551 a(0)=1. a(n) = a(n-1)*2, if n is in the sequence. a(n) = a(n-1) + 1 if n is missing from the sequence.

Original entry on oeis.org

1, 2, 4, 5, 10, 20, 21, 22, 23, 24, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 114, 228, 456, 912, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 3694, 7388, 14776
Offset: 0

Views

Author

Leroy Quet, May 03 2006

Keywords

Programs

  • Mathematica
    f[s_] := Block[{n = Length@s}, Append[s, If[ MemberQ[s, n], 2s[[ -1]], s[[ -1]] + 1]]]; Nest[f, {1}, 50] (* Robert G. Wilson v, May 16 2006 *)

Extensions

More terms from Robert G. Wilson v, May 16 2006