Big numbers, repeated least significant digits - MATLAB Cody - MATLAB Central

Problem 3079. Big numbers, repeated least significant digits

Difficulty:Rate
This problem builds off of Problem 3077
Given an integer x which contains d digits, find the value of (minimum) n (n > 1) such that the last d digits of x^n is equal to x. If the last d digits will never equal x, return inf.
Example 1:
  • x = 2; (therefore d = 1)
  • 2^2 = 4, 2^3 = 8, 2^4 = 16, 2^5 = 32
  • n = 5;
Example 2:
  • x = 10; (therefore d = 2)
  • 10^2 = 100, 10^3 = 1000, etc
  • n = inf;

Solution Stats

25.76% Correct | 74.24% Incorrect
Last Solution submitted on Mar 02, 2025

Problem Comments

Solution Comments

Show comments

Group

Project Euler II Image
Project Euler II
  • 12 Problems
  • 51 Finishers

Problem Recent Solvers73

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page