Problem 55595. Easy Sequences 87: Perfect Power Modular Residue of a Nested Sum-product Function
For a positive integer x, we define the function Y, as follows:
Hence, for
we have:
And if
:
-----------------------------
We now consider the following congruence:
The congruence expresses the possibility that the nested sum and product function defined above (Y), can have a perfect power residue in some modular base. In fact, solving for x, the congruence always have a trivial solution, namely
, that's because
, which is, of course, a perfect power in any modular base.
Given the value of integers N, M, and certain limit L, find the sum S of all positive integer values of
, that satisfies the above congruence.
For
,
and
, we see that only
and
satisfies the congruence, since:
Therefore in this case S(20,7,3) = 1 + 5 = 6.
For
,
and
, the above equation is satisfied,
.
Therefore: S(20,10,3) = sum(1:20) = 210.
Solution Stats
Problem Comments
-
2 Comments
David Hill
on 1 Jan 2023
I am getting all test solutions correct except: test2, test5, and test8.
For test2 for example, I am only getting [1 5] = 6.
Ramon Villamangca
on 2 Jan 2023
Hi David, test suites has been corrected. Please try again. Thanks.
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
-
Back to basics 22 - Rotate a matrix
909 Solvers
-
"Low : High - Low : High - Turn around " -- Create a subindices vector
545 Solvers
-
find the maximum element of the matrix
508 Solvers
-
find the surface area of a cube
535 Solvers
-
Sum the squares of numbers from 1 to n
248 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!