The TransCompilator

Solved LeetCode program · 866 of 1,000

#1175 · Prime Arrangements

Easy Math chunk-18.md

Original English source

Keep a shared prime of 0.

To check from value (a whole number). Set prime to 0. If value is less than 2, return. Set prime to 1. The limit is value minus 1.
For every divisor from 2 to limit.
If value modulo divisor is 0, set prime to 0, stop.

The size is 100. The primes is 0. The rest is 0.
For every value from 1 to size.
Check from value. If prime is 1, add 1 to primes. If prime is 0, add 1 to rest.

The modulus is 1000000007. The answer is 1.
For every value from 2 to primes.
Set answer to (answer times value) modulo modulus.

For every value from 2 to rest.
Set answer to (answer times value) modulo modulus.

Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

682289015