4 kyu

Last digits of N^2 == N

57 of 630Ivana

Description:

This is a very simply formulated task. Let's call an integer number N 'green' if 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 the nth green number, starting with 1 - green (1) == 1


Input range

n <= 4000
Algorithms

More By Author:

Check out these other kata created by Ivana

Stats:

CreatedDec 12, 2016
PublishedDec 12, 2016
Warriors Trained7187
Total Skips1546
Total Code Submissions8843
Total Times Completed630
Haskell Completions57
Python Completions303
JavaScript Completions66
Java Completions194
C# Completions42
Total Stars307
% of votes with a positive feedback rating88% of 160
Total "Very Satisfied" Votes129
Total "Somewhat Satisfied" Votes23
Total "Not Satisfied" Votes8
Total Rank Assessments9
Average Assessed Rank
4 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • Ivana Avatar
  • JohanWiltink Avatar
  • Blind4Basics Avatar
  • Voile Avatar
  • Madjosz Avatar
  • KataSideKick Avatar
  • hobovsky Avatar
  • dfhwze Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad