This is a very simply formulated task. Let's call an integer number N
'green' if N²
ends with all of the digits of N
. Some examples:
5
is green, because 5² = 25
and 25
ends with 5
.
11
is not green, because 11² = 121
and 121
does not end with 11
.
376
is green, because 376² = 141376
and 141376
ends with 376
.
Your task is to write a function green
that returns n
th green number, starting with 1
- green (1) == 1
`n <= 5000` for Java