RosettaCodeData/Task/Prime-decomposition/00DESCRIPTION

33 lines
1.3 KiB
Text
Raw Permalink Normal View History

2015-02-20 00:35:01 -05:00
{{omit from|GUISS}}
2016-12-05 22:15:40 +01:00
2015-02-20 00:35:01 -05:00
The prime decomposition of a number is defined as a list of prime numbers
which when all multiplied together, are equal to that number.
2013-04-10 23:57:08 -07:00
2015-02-20 00:35:01 -05:00
2016-12-05 22:15:40 +01:00
;Example:
12 = 2 × 2 × 3, so its prime decomposition is {2, 2, 3}
;Task:
Write a function which returns an [[Arrays|array]] or [[Collections|collection]] which contains the prime decomposition of a given number &nbsp; <big><big><math>n</math></big></big> &nbsp; greater than &nbsp; '''1'''.
2015-02-20 00:35:01 -05:00
If your language does not have an isPrime-like function available,
you may assume that you have a function which determines
whether a number is prime (note its name before your code).
2013-04-10 23:57:08 -07:00
2015-11-18 06:14:39 +00:00
If you would like to test code from this task, you may use code from [[Primality by trial division|trial division]] or the [[Sieve of Eratosthenes]].
2013-04-10 23:57:08 -07:00
Note: The program must not be limited by the word size of your computer or some other artificial limit; it should work for any number regardless of size (ignoring the physical limits of RAM etc).
2015-11-18 06:14:39 +00:00
2016-12-05 22:15:40 +01:00
;Related tasks:
2017-09-23 10:01:46 +02:00
* &nbsp; [[count in factors]]
* &nbsp; [[factors of an integer]]
2016-12-05 22:15:40 +01:00
* &nbsp; [[Sieve of Eratosthenes]]
2017-09-23 10:01:46 +02:00
* &nbsp; [[primality by trial division]]
* &nbsp; [[factors of a Mersenne number]]
* &nbsp; [[trial factoring of a Mersenne number]]
* &nbsp; [[partition an integer X into N primes]]
* &nbsp; [[sequence of primes by Trial Division]]
2016-12-05 22:15:40 +01:00
<br><br>