Skip to content

Commit 7ba5e47

Browse files
prep done for persistantBugger multiplicative
1 parent 46d203c commit 7ba5e47

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

6kyus/js/persistentBugger.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// input is a positive integer
2+
// return single digit integer
3+
4+
// multiplicative persistence is number of times you must multiply the digits in num until you reach a single digit
5+
// if num is single digit already then it should return 0
6+
7+
function persistence(num) {
8+
// pseudocode:
9+
// create counter
10+
// create a while loop that only runs when num is less than 10
11+
// convert num to string
12+
// string to array
13+
// reduce to new num
14+
// return num
15+
}
16+
17+
console.log(persistence(39), 3)
18+
console.log(persistence(999), 4)

0 commit comments

Comments
 (0)