-3
\$\begingroup\$

This question already has an answer here:

It's been a while since I posted here, so here we go another day another challenge.

Challenge :

Given a number(n) split it into it's prime factors.


Input :

A positive non-zero integer greater than 2.


Output :

Decompose the number into it's prime factors and return the number of occurances of each prime in it.


Ouput format :

You can choose Any valid output format.


Example :

n = 86240 
              v------------------------------- number of times it occurs in n 
output : [[2, 5], [5, 1], [7, 2], [11, 1]]
           ^-------------------------------- prime number

n = 7775460
                           v--------------- 5 only occurs once in 7775460 so we don't need to write any power 
output : [[2, 2], [3, 3], [5], [7], [11, 2], [17]]
            ^--------------------------------- same as first example

Note :

  • Prime factors have to be in either ascending order or descending order.
  • You may choose to either write 1 as power or note

Winning criterion :

This is so shortest code in bytes for each programming language wins

\$\endgroup\$

marked as duplicate by Beta Decay, Luis felipe De jesus Munoz, pajonk, ovs code-golf Aug 10 '18 at 11:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1
\$\begingroup\$

Jelly, 2 bytes

Built in command =)

ÆF

Try it online!


Brachylog, 10 bytes

ḋ≡ᵍ⟨h≡l⟩ᵐ

-1 bytes thanks to Erik the Outgolfer

Try it online!

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.