Data Structures & AlgorithmsVery hardGATE CS · TCS NQT

What is the exponent of 3 in the prime factorisation of 30!?

  1. A. 15
  2. B. 14
  3. C. 10
  4. D. 12

Correct answer: B. 14

Legendre's formula sums floor(30 / 3^k): 10 + 3 + 1 = 14. Stopping at the first term (the middle option) undercounts multiples of 9 and 27.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic