A composite integer n (n>=2) divides b^n-b, i.e. mod(b^n-b,n)==0, for all integers b if and only if n is square-free (doesn't have repeating prime factors) and n-1 is divisible by p-1, i.e. mod(n-1,p-1)==0, for all prime divisors p of n.
Given a positive integer x, return c, the number of integers n satisfying Korselt's Criterion, where 1 < n < 10^x.
Example:
x = 2;
c = 0
Example:
x = 3;
c = 1
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers7
Suggested Problems
-
Return the largest number that is adjacent to a zero
5526 Solvers
-
5119 Solvers
-
1628 Solvers
-
529 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
893 Solvers
More from this Author45
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!