Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rija/primefactors-nodejs-lsia-codingdojo
TDD Kata for prime factorisation
https://github.com/rija/primefactors-nodejs-lsia-codingdojo
Last synced: about 1 month ago
JSON representation
TDD Kata for prime factorisation
- Host: GitHub
- URL: https://github.com/rija/primefactors-nodejs-lsia-codingdojo
- Owner: rija
- Created: 2016-06-24T09:26:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-24T09:35:39.000Z (over 8 years ago)
- Last Synced: 2024-11-02T15:42:27.081Z (3 months ago)
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Prime Factors of Positive Integer Number
## Definition
The prime factorisation of a positive integer is a list of the integer's prime factors, together with their multiplicities.
to shorten prime number factorisations, factors are often expressed in powers (multiplicities).
example:
```
360 = 2 x 2 x 2 x 3 x 3 x 5 = 2^3 x 3^2 x 5
```
For a prime factor `p` of `n`, the multiplicity of `p` is the largest exponent `a` for which `p^a` divides n exactly.## Problem to solve (Part 1)
Write a program that returns the list of prime factors for all positive integers from 1 to 100.
Example:
```
1 -> []
5 -> [5]
8 -> [2, 2, 2]
9 -> [3, 3]
```### If time allows:
Discuss the performance of the implementation.
## Problem to solve (Part 2)
sWrite a program that returns the list of prime factors and their multiplicities for all positive integers from 1 to 1000.
Example:```
1 -> []
5 -> [ [5,1] ]
8 -> [ [2,3] ]
9 -> [ [3,2] ]
360 -> [ [2,3], [3,2] , [5,1] ]
```## Running the kata
```
$ git clone https://github.com/rija/primefactors-nodejs-lsia-codingdojo
$ cd primefactors-nodejs-lsia-codingdojo
$ npm install
$ npm test
```