Skip to main content
Tweeted twitter.com/StackCodeGolf/status/916083217974820864
edited tags
Link
Stephen
  • 14k
  • 3
  • 52
  • 117
another test case
Source Link
anatolyg
  • 13.9k
  • 2
  • 39
  • 110

Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root). The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors). The OEIS sequence formed by prime factoral roots is A029908.

For example, the prime factoral root of 24 is:

24=2*2*2*3

2+2+2+3=9=3*3

3+3=6=2*3

2+3=5, and the only prime factor of 5 is 5.  Therefore, the prime factoral root of 24 is 5.  

##Your Task:

Write a program or function that finds the prime factoral root of an input integer.

##Input:

An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive). Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)

##Output:

An integer, the prime factoral root of the input.

##Test Cases:

4   -> 4
24  -> 5
11  -> 11
250 -> 17

##Scoring:

This is , lowest score in bytes wins!

Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root). The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors). The OEIS sequence formed by prime factoral roots is A029908.

For example, the prime factoral root of 24 is:

24=2*2*2*3

2+2+2+3=9=3*3

3+3=6=2*3

2+3=5, and the only prime factor of 5 is 5.  Therefore, the prime factoral root of 24 is 5.  

##Your Task:

Write a program or function that finds the prime factoral root of an input integer.

##Input:

An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive). Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)

##Output:

An integer, the prime factoral root of the input.

##Test Cases:

24  -> 5
11  -> 11
250 -> 17

##Scoring:

This is , lowest score in bytes wins!

Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root). The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors). The OEIS sequence formed by prime factoral roots is A029908.

For example, the prime factoral root of 24 is:

24=2*2*2*3

2+2+2+3=9=3*3

3+3=6=2*3

2+3=5, and the only prime factor of 5 is 5.  Therefore, the prime factoral root of 24 is 5.  

##Your Task:

Write a program or function that finds the prime factoral root of an input integer.

##Input:

An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive). Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)

##Output:

An integer, the prime factoral root of the input.

##Test Cases:

4   -> 4
24  -> 5
11  -> 11
250 -> 17

##Scoring:

This is , lowest score in bytes wins!

Source Link
Gryphon
  • 7.3k
  • 3
  • 30
  • 73

Prime Factoral Roots

Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime factoral root). The prime factoral root of 4 is 4, as 2*2=2+2, and this is the only non-prime prime factoral root of an integer greater than 1 (which is another special case, as it has no prime factors). The OEIS sequence formed by prime factoral roots is A029908.

For example, the prime factoral root of 24 is:

24=2*2*2*3

2+2+2+3=9=3*3

3+3=6=2*3

2+3=5, and the only prime factor of 5 is 5.  Therefore, the prime factoral root of 24 is 5.  

##Your Task:

Write a program or function that finds the prime factoral root of an input integer.

##Input:

An integer, input through any reasonable method, between 2 and the largest integer your language will support (inclusive). Specifically choosing a language that has an unreasonably low maximum integer size is not allowed (and also violates this standard loophole)

##Output:

An integer, the prime factoral root of the input.

##Test Cases:

24  -> 5
11  -> 11
250 -> 17

##Scoring:

This is , lowest score in bytes wins!