Factors of an integer: Difference between revisions
Content added Content deleted
(add BQN) |
(→{{header|BQN}}: Version based on prime factorization) |
||
Line 1,350: | Line 1,350: | ||
<lang>⟨ 1 3 5 15 823 2469 4115 12345 ⟩ |
<lang>⟨ 1 3 5 15 823 2469 4115 12345 ⟩ |
||
⟨ 1 3 9 27 81 243 729 ⟩</lang> |
⟨ 1 3 9 27 81 243 729 ⟩</lang> |
||
The [https://github.com/mlochbaum/bqn-libs/blob/master/primes.bqn primes] library from bqn-libs can be used for a solution that's more efficient for large inputs. <code>FactorExponents</code> returns each unique prime factor along with its exponent. |
|||
<lang bqn>⟨FactorExponents⟩ ← •Import "primes.bqn" # With appropriate path |
|||
Factors ← { ∧⥊ 1 ×⌜´ ⋆⟜(↕1+⊢)¨˝ FactorExponents 𝕩 }</lang> |
|||
=={{header|Burlesque}}== |
=={{header|Burlesque}}== |