HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Prove by exhaustion that no perfect square ends in the digit 2, 3, 7 or 8…
AdvancedMathematicsHigh School (11–12)Mathematical ReasoningproofNumericalBoard Exam
+2 more exams
A-LevelIB
A-LevelIB

Prove by exhaustion that no perfect square ends in the digit 2, 3, 7 or 8…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

Prove by exhaustion that no perfect square ends in the digit 222, 333, 777 or 888. First explain why the last digit of n2n^2n2 depends only on the last digit of nnn. Then list the cases. How many different last digits can a perfect square have? A friend asks whether the same is true for cubes. How many different last digits can a perfect cube have? What does that tell you about using last digits to rule out cubes?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

Direct proof: assume ppp, reach qqq. Contrapositive: assume ∼q\sim q∼q, reach ∼p\sim p∼p. Exhaustion: check every one of finitely many cases. One counterexample disproves a for-all claim.

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Why only the last digit matters. Let n=10t+dn = 10t + dn=10t+d, with ddd the last digit. Then n2=10(10t2+2td)+d2n^2 = 10(10t^2 + 2td) + d^2n2=10(10t2+2td)+d2, so n2n^2n2 ends in the last digit of d2d^2d2.

Step 2. The ten cases. d2d^2d2 for d=0,…,9d = 0, \dots, 9d=0,…,9 is 0,1,4,9,16,25,36,49,64,810, 1, 4, 9, 16, 25, 36, 49, 64, 810,1,4,9,16,25,36,49,64,81. The last digits are 0,1,4,9,6,5,6,9,4,10, 1, 4, 9, 6, 5, 6, 9, 4, 10,1,4,9,6,5,6,9,4,1.

Step 3. Count. The different last digits are 0,1,4,5,6,90, 1, 4, 5, 6, 90,1,4,5,6,9: 666 of them. None is 222, 333, 777 or 888, which proves the claim.

Step 4. Cubes. d3d^3d3 for d=0,…,9d = 0, \dots, 9d=0,…,9 is 0,1,8,27,64,125,216,343,512,7290, 1, 8, 27, 64, 125, 216, 343, 512, 7290,1,8,27,64,125,216,343,512,729. The last digits are 0,1,8,7,4,5,6,3,2,90, 1, 8, 7, 4, 5, 6, 3, 2, 90,1,8,7,4,5,6,3,2,9: all 101010 digits.

Step 5. What it means. Every digit can end a cube, so the last digit can never rule out a cube.

Answer: squares have 666 possible last digits; cubes have all 101010.

Log in to save this for later
← All Problems
← The formula f(n) = n² + n + 41 gives a prime for n = 0, 1, 2, … for a long time…Prove by contradiction that √3 is irrational… →
More onMathematical Reasoning

Discussion (0)

Log in to join the discussion.

Loading…

Learn it in

  1. Direct proof, contrapositive and counterexampleValid Arguments and Methods of Proof

More on this topic

  1. Prove by cases that for every integer n, n² leaves remainder 0 or 1 when divided by 3…Advanced
  2. Prove by contradiction that there are no integers a and b with 6a + 9b = 100…Advanced
  3. Prove by contradiction that √3 is irrational…Hard
The formula f(n) = n² + n + 41 gives a prime for n = 0, 1, 2, … for a long time…Advanced
  • For integers a and b, prove that if a + b ≥ 15, then a ≥ 8 or b ≥ 8…Hard
  • All problems on this topic →