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.

A284630 a(1)=1, a(2)=2; for n > 1, a(n+1) = (a(n-1) mod n) + n.

Original entry on oeis.org

1, 2, 3, 5, 7, 5, 7, 12, 15, 12, 15, 12, 15, 25, 15, 25, 31, 25, 31, 25, 31, 25, 31, 25, 31, 25, 31, 52, 31, 52, 31, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 52, 63, 105, 63, 105, 63, 105, 63, 105, 63, 105, 63, 105, 127, 105, 127, 105, 127, 105, 127, 105, 127, 105, 127, 105, 127, 105, 127, 105
Offset: 1

Views

Author

Thomas Kerscher, Mar 31 2017

Keywords

Examples

			a(3) = a(1) (mod 2) + 2 = 3.
		

Crossrefs

Cf. A003817.

Programs

  • Maple
    A[1]:= 1: A[2]:= 2:
    for n from 3 to 200 do A[n]:= (A[n-2] mod (n-1)) + n-1 od:
    seq(A[n],n=1..200); # Robert Israel, Apr 04 2017
  • Mathematica
    a[n_] := a[n] = If[n < 3, n, Mod[a[n - 2], n - 1] + n - 1]; Array[a, 80] (* Michael De Vlieger, Apr 02 2017 *)
    nxt[{n_,a_,b_}]:={n+1,b,Mod[a,n]+n}; NestList[nxt,{2,1,2},100][[;;,2]] (* Harvey P. Dale, Jul 31 2023 *)
  • PARI
    a(n) = if (n<=2, n, (n-1) + a(n-2) % (n-1)); \\ Michel Marcus, Apr 02 2017