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.

A349182 a(0) = 1; for n>0, a(n) is the smallest positive integer such that |n - a(n-1)| + a(n) is a square.

Original entry on oeis.org

1, 1, 3, 1, 1, 5, 3, 5, 1, 1, 7, 5, 2, 5, 7, 1, 1, 9, 7, 4, 9, 4, 7, 9, 1, 1, 11, 9, 6, 2, 8, 2, 6, 9, 11, 1, 1, 13, 11, 8, 4, 12, 6, 12, 4, 8, 11, 13, 1, 1, 15, 13, 10, 6, 1, 10, 3, 10, 1, 6, 10, 13, 15, 1, 1, 17, 15, 12, 8, 3, 14, 7, 16, 7, 14, 3, 8, 12, 15, 17, 1, 1, 19, 17, 14, 10, 5, 18, 11
Offset: 0

Views

Author

Scott R. Shannon, Nov 09 2021

Keywords

Examples

			a(1) = 1 as |1 - a(0)| = |1 - 1| = 0, and 0 + 1 = 1 = 1^2 is the next smallest square.
a(2) = 3 as |2 - a(1)| = |2 - 1| = 1, and 1 + 3 = 4 = 2^2 is the next smallest square.
a(5) = 5 as |5 - a(4)| = |5 - 1| = 4, and 4 + 5 = 9 = 3^2 is the next smallest square.
		

Crossrefs

Programs

  • Mathematica
    nxt[{n_,a_}]:={n+1,Module[{k=1},While[!IntegerQ[Sqrt[(Abs[n+1-a])+k]],k++];k]}; NestList[ nxt,{0,1},90][[;;,2]] (* Harvey P. Dale, Aug 20 2024 *)