OFFSET
0,3
FORMULA
EXAMPLE
Among the first five integers 0, 1, 2, 3, and 4 the squares are 0, 1, and 4. Thus the first five terms in the sequence are 0, 1, 2, 3, and 2.
MATHEMATICA
Table[If[IntegerQ[Sqrt[n]], Sqrt[n], n], {n, 0, 100}] (* Harvey P. Dale, Jul 09 2017 *)
PROG
(PARI) g(n) = for(x=0, n, if(issquare(x), y=sqrt(x), y=x); print1(floor(y)", "))
(PARI) for(n=0, 74, print1(if(issquare(n, &m), m, n)", ")) \\ Zak Seidov, Feb 21 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Cino Hilliard, Aug 23 2004
STATUS
approved