In this challenge, you have to separate integers into two families, establishing if they are Junction Numbers or Self Numbers. Given a number n:
If exists at least a single number which added to the sum of its digits is equal to n, then n is a Junction Number.
If there are not numbers which added to the sum of their digits are equal to n, then n is a Self Number.
Given a positive integer n, implement a function that returns:
"Self" if n is a Self Number.n is a Junction Number an array, ordered descendingly, containing the numbers which generate n.junctionOrSelf(25) ➞ [17]
// If we add 17 to the sum of its digits...
// ...17 + 1 + 7 = 25
// 25 is a Junction Number
junctionOrSelf(818) ➞ [805, 796]
// If we add 805 to the sum of its digits...
// ...805 + 8 + 0 + 5 = 818
// If we add 796 to the sum of its digits...
// ...796 + 7 + 9 + 6 = 818
// 818 is a Junction Number
junctionOrSelf(7) ➞ "Self"
// 1 + 1 = 2
// 2 + 2 = 4
// 3 + 3 = 6
// No number added to its own digits is equal to 7
// 7 is a Self Number
10000000000001, while the first generated by four different numbers is 1000000000000000000000102.