user
Task

Show that the following remarkable formula gives the sequence of non-square natural numbers:

```
            n + floor(1/2 + sqrt(n)) 

```

* Print out the values for    n    in the range   **1**   to   **22**
* Show that no squares occur for    n    less than one million

This is sequence   A000037   in the **OEIS** database.
assistant
(formerly Perl 6)

**Works with**: Rakudo version 2016.07

```
sub nth-term (Int $n) { $n + round sqrt $n }

# Print the first 22 values of the sequence
say (nth-term $_ for 1 .. 22);

# Check that the first million values of the sequence are indeed non-square
for 1 .. 1_000_000 -> $i {
    say "Oops, nth-term($i) is square!" if (sqrt nth-term $i) %% 1;
}

```

Output:

```
(2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27)
```