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.

A350757 a(1)=1; for n>1, a(n) is the smallest number k > a(n-1) such that a(n-1) + k is not a square.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
Offset: 1

Views

Author

J. Lowell, Jan 13 2022

Keywords

Comments

Complement of A099776.

Examples

			5 is not a term because 4 + 5 = 9 = 3^2.
		

Crossrefs

Cf. A099776.

Programs

  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{k = a[n - 1] + 1}, While[IntegerQ[Sqrt[a[n - 1] + k]], k++]; k]; Array[a, 100] (* Amiram Eldar, Jan 14 2022 *)
  • PARI
    lista(nn) = {my(x=1, list=List(x)); for (n=2, nn, my(k=x+1); while (issquare(x+k), k++); listput(list, k); x = k;); list;} \\ Michel Marcus, Jan 14 2022
    
  • Python
    from math import isqrt
    def A350757(n): return n+(m:=isqrt(n>>1))-int(n<=m*((m<<1)+1)+1) if n>1 else 1 # Chai Wah Wu, Oct 01 2024

Formula

For n>1, a(n) = n+m if n>m(2m+1)+1 and a(n) = n+m-1 otherwise where m = floor(sqrt(n/2)). - Chai Wah Wu, Oct 01 2024