OFFSET
1,2
COMMENTS
Complement of A099776.
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
EXAMPLE
5 is not a term because 4 + 5 = 9 = 3^2.
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 *)
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
J. Lowell, Jan 13 2022
STATUS
approved