Skip to main content
deleted 365 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Jelly, 65 bytes

!ÆEṫ3ḢÆfċ5

Uses the counterproductive approach of finding the factorial then factorising it again, checking for the exponent of 5 in the prime factorisation.

Try it online!Try it online!

!              Factorial
 ÆEÆf            List of prime exponentsfactors, e.g. 120 -> [3, 1[2, 1]
   ṫ3          Remove the first two elements - if n < 52, this results in an empty list
     Ḣ         Pop first2, returning the exponent of 5 if ÆE returned a list of length >= 3,
     5]
   ċ5       otherwise 0 is returnedCount implicitlynumber returnedof instead5s

Note that we can't index with 3ị since works cyclically, and for n = 4 it would extract 3 from the factorisation list [3, 1].

Jelly, 6 bytes

!ÆEṫ3Ḣ

Uses the counterproductive approach of finding the factorial then factorising it again, checking for the exponent of 5 in the prime factorisation.

Try it online!

!              Factorial
 ÆE            List of prime exponents, e.g. 120 -> [3, 1, 1]
   ṫ3          Remove the first two elements - if n < 5, this results in an empty list
     Ḣ         Pop first, returning the exponent of 5 if ÆE returned a list of length >= 3,
               otherwise 0 is returned implicitly returned instead

Note that we can't index with 3ị since works cyclically, and for n = 4 it would extract 3 from the factorisation list [3, 1].

Jelly, 5 bytes

!Æfċ5

Uses the counterproductive approach of finding the factorial then factorising it again, checking for the exponent of 5 in the prime factorisation.

Try it online!

!              Factorial
 Æf            List of prime factors, e.g. 120 -> [2, 2, 2, 3, 5]
   ċ5          Count number of 5s
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Jelly, 6 bytes

!ÆEṫ3Ḣ

Uses the counterproductive approach of finding the factorial then factorising it again, checking for the exponent of 5 in the prime factorisation.

Try it online!

!              Factorial
 ÆE            List of prime exponents, e.g. 120 -> [3, 1, 1]
   ṫ3          Remove the first two elements - if n < 5, this results in an empty list
     Ḣ         Pop first, returning the exponent of 5 if ÆE returned a list of length >= 3,
               otherwise 0 is returned implicitly returned instead

Note that we can't index with 3ị since works cyclically, and for n = 4 it would extract 3 from the factorisation list [3, 1].