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.

A200044 Starting with a(1)=1, a(n) = n*a(n-1) if n>= a(n-1), otherwise a(n) = a(n-1)-n.

Original entry on oeis.org

1, 2, 6, 2, 10, 4, 28, 20, 11, 1, 11, 132, 119, 105, 90, 74, 57, 39, 20, 400, 379, 357, 334, 310, 285, 259, 232, 204, 175, 145, 114, 82, 49, 15, 525, 489, 452, 414, 375, 335, 294, 252, 209, 165, 120, 74, 27, 1296, 1247, 1197, 1146, 1094
Offset: 1

Views

Author

Rodolfo Kurchan, Nov 12 2011

Keywords

Examples

			Start with 1, then as 2 is bigger than 1, 1 * 2 = 2. As n=3 is bigger than 2, 2 * 3 = 6. As n=4 is smaller than 6, 6 - 4 = 2, then 2 * 5 = 10, then 10 - 6 = 4, then 4 * 7 = 28, etc
		

Programs

  • Maple
    A200044 := proc(n)
        option remember;
        if n = 1 then
            1;
        elif n >= procname(n-1) then
            n*procname(n-1) ;
        else
            procname(n-1)-n ;
        end if;
    end proc:
    seq(A200044(n),n=1..80) ; # R. J. Mathar, Jan 28 2012
  • Mathematica
    a = {1}; Do[AppendTo[a, If[a[[-1]] <= n, a[[-1]]*n, a[[-1]] - n]], {n, 2, 52}]; a (* Ivan Neretin, May 20 2015 *)
    nxt[{n_,a_}]:={n+1,If[n+1>=a,a(n+1),a-n-1]}; NestList[nxt,{1,1},60][[All,2]] (* Harvey P. Dale, Oct 20 2016 *)