A k-hyperperfect number is a natural number n for which the equality n = 1 + k(σ(n) − n − 1) holds, where σ(n) is the divisor function (i.e., the sum of all positive divisors of n).
%Example
sigma(6) = 1 + 2 + 3 + 6 = 12
%for k=1
1 + 1*(12-6-1) = 1 + 5 = 6
%Example
sigma(325) = 1 + 5 + 13 + 25 + 65 + 325 = 434
%for k=3
1 + 3*(434-325-1) = 1 + 3*108 = 324
Given a number x, return the xth Hyperperfect number (serial/order wise) and corresponding k value.
P.S - Check the test suite for banned functions. More functions might be added later to prevent hard coded solutions.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers5
Suggested Problems
-
Project Euler: Problem 8, Find largest product in a large string of numbers
1330 Solvers
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
560 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
461 Solvers
-
Permute diagonal and antidiagonal
517 Solvers
-
Back to basics - mean of corner elements of a matrix
470 Solvers
More from this Author44
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!