Problem 45543. Find the remainder with the factorial of PRIMES?
- Take a number greater than or equal to 2 and take its primes. e.g. 6 and its primes are 2 3 5
- calculate the factorial of its prime (nearest less) and calculate the sum from that number down to 1. e.g. 5! = 120 and sum 5 to 1 is 15
- As mod of the factorial of every number with 2 is zero, check the mod of the sum calculated with 10 e.g. mod of 15 with 10 is 5
- Divide factorial with the remainder (if possible). e.g. 120/5 = 24
Don't use builtin functions
primes
factorial
mod
Solution Stats
Problem Comments
-
1 Comment
Dyuman Joshi
on 20 May 2021
Test suit has been fixed, though the OP seems to miss the fact that people can still use rem().
Solution Comments
Show commentsProblem Recent Solvers12
Suggested Problems
-
Create a square matrix of multiples
495 Solvers
-
Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4
139 Solvers
-
628 Solvers
-
Remove element(s) from cell array
1966 Solvers
-
Area of an equilateral triangle
6762 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!