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.

A022941 a(n) = a(n-1) + c(n-2) for n >= 3, a( ) increasing, given a(1)=1, a(2)=2; where c( ) is complement of a( ).

Original entry on oeis.org

1, 2, 5, 9, 15, 22, 30, 40, 51, 63, 76, 90, 106, 123, 141, 160, 180, 201, 224, 248, 273, 299, 326, 354, 383, 414, 446, 479, 513, 548, 584, 621, 659, 698, 739, 781, 824, 868, 913, 959, 1006, 1054, 1103, 1153, 1205, 1258, 1312, 1367, 1423, 1480, 1538
Offset: 1

Views

Author

Keywords

Comments

Except for a(2), identical to A022940. - Ivan Neretin, Apr 05 2016

Crossrefs

Cf. A143344 (first differences), A156031.
Cf. A005228 and references therein.

Programs

  • Haskell
    import Data.List (delete)
    a022941 n = a022941_list !! (n-1)
    a022941_list = 1 : 2 : f 2 [3..] where
       f x (z:zs) = y : f y (delete y zs) where y = x + z
    -- Reinhard Zumkeller, May 17 2013
  • Maple
    a[1]:=1: a[2]:=2: c[1]:=3: for n from 2 to 70 do c[n]:=c[n-1]+1: for k from 1 to n do if(c[n]<=a[k])then if(c[n]=a[k])then c[n]:=c[n]+1: fi: break: fi: od: a[n+1]:=a[n]+c[n-1]: od: seq(a[n],n=1..70); # Nathaniel Johnston, May 01 2011
  • Mathematica
    Fold[Append[#1, #1[[-1]] + Complement[Range[Max@#1 + 1], #1][[#2]]] &, {1, 2}, Range[50]] (* Ivan Neretin, Apr 04 2016 *)

Extensions

a(27) inserted by Nathaniel Johnston, May 01 2011