Hash table of factorials

Report a typo

Remember the factorial n!=123...nn! = 1*2*3*...*n. We want to store a hash table of all the factorials up to 100!100! and we want to use a hash function of the form h(n)=n % ph(n) = n\ \%\ p. Which would be a good value for pp?

You can consider that the hash table has more than pp buckets and that we can fit numbers up to 100!100! in variables.

Tips for those who don't love math:

  1. The reminder of n!n! with n,  n1,,2n, \; n-1, \dots , 2 is equal to 00. Why?

  2. 105=357105 = 3 * 5 * 7

  3. 101101, 4747, and 55 are prime numbers.

Select one option from the list
___

Create a free account to access the full topic