A program that converts a number to a string, the contents of which depends on the number’s prime factors.
- If the number contains
3
as a prime factor, it outputs"Pling"
- If the number contains
5
as a prime factor, it outputs"Plang"
- If the number contains
7
as a prime factor, it outputs"Plong"
- If the number does not contain
3
,5
, or7
as a prime factor, it just passes the number’s digits straight through.
28's
prime-factorization is2
,2
,7
.
In raindrop-speak, this would be a simple"Plong"
.1755
prime-factorization is3
,3
,3
,5
,13
.
In raindrop-speak, this would be a"PlingPlang"
.- The prime factors of
34
are2
and17
.
Raindrop-speak doesn’t know what to make of that, so it just going to pass the input digits and the result would be"34"
.
- clone the repo.
- cd into the projects directory
- run the following commands
npm install
to install the needed packagesnpm test
to test the program itselfnpm start
to see the program in action(with an input of 28).
I like to include this section in most of my personal projects/programs. It reminds me(and inform you) of what made me built the project.
I was applying to be a part of a Technical Leadership Program at Andela and this program was part of the technical challenges I needed to complete in the bootcamp phase of the application. It is meant to prove my understanding of basic programming logic with Test Driven Development.
In case you got curious about what Andela is or what the recruitment was like, you can get more info about that here.