Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Jelly, 5 bytes

ÆfI¬S

Try it online!

Verify all testcases.

Port of Luis Mendo's answer in MATLLuis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display

Jelly, 5 bytes

ÆfI¬S

Try it online!

Verify all testcases.

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display

Jelly, 5 bytes

ÆfI¬S

Try it online!

Verify all testcases.

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display
added 94 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284

Jelly, 5 bytes

ÆfI¬S

Try it online!

Verify all testcases.

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display

Jelly, 5 bytes

ÆfI¬S

Try it online!

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display

Jelly, 5 bytes

ÆfI¬S

Try it online!

Verify all testcases.

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display
deleted 785 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284

Jelly, 7 bytes5 bytes

ÆFµSṪ_LÆfI¬S

Try it online!Try it online!

ÆFµSṪ_L

ÆF        Compute prime factorization as [prime, exponent] pairs.
  µ       Start a new monadic chain whose argument is above.
   S      Vectorized sum (sum of primes, sum of exponents).
    Ṫ     Last element (sum of exponents).
     _    Above minus below.
      L   Length (of the [prime, exponent] pairs).

Alternative

ÆfµQLạL

Try it online! Port of Luis Mendo's answer in MATL.

ÆfµQLạLÆfI¬S

Æf        Compute the array of primes whose product is z.
  µ       Start a new monadic chain whose argument isImplicit aboveinput.
   Q     Obtain Uniqueprime elementsfactors, sorted byand firstwith appearance.repetitions
    LI    Consecutive Length.differences
      ¬   Above absolute_differenceLogical below.
negate: zeros become 1, nonzeros become L0
   Length (ofS the [prime,Sum. exponent]Implicit pairs).display

Jelly, 7 bytes

ÆFµSṪ_L

Try it online!

ÆFµSṪ_L

ÆF        Compute prime factorization as [prime, exponent] pairs.
  µ       Start a new monadic chain whose argument is above.
   S      Vectorized sum (sum of primes, sum of exponents).
    Ṫ     Last element (sum of exponents).
     _    Above minus below.
      L   Length (of the [prime, exponent] pairs).

Alternative

ÆfµQLạL

Try it online!

ÆfµQLạL

Æf        Compute the array of primes whose product is z.
  µ       Start a new monadic chain whose argument is above.
   Q      Unique elements sorted by first appearance.
    L     Length.
         Above absolute_difference below.
      L   Length (of the [prime, exponent] pairs).

Jelly, 5 bytes

ÆfI¬S

Try it online!

Port of Luis Mendo's answer in MATL.

ÆfI¬S

Æf     Implicit input. Obtain prime factors, sorted and with repetitions
  I    Consecutive differences
   ¬   Logical negate: zeros become 1, nonzeros become 0
    S  Sum. Implicit display
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading