login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A200044
Starting with a(1)=1, a(n) = n*a(n-1) if n>= a(n-1), otherwise a(n) = a(n-1)-n.
2
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,2
LINKS
EXAMPLE
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
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 *)
CROSSREFS
Sequence in context: A267859 A002172 A126289 * A154382 A136762 A136697
KEYWORD
nonn,easy
AUTHOR
Rodolfo Kurchan, Nov 12 2011
STATUS
approved