Let be a natural number. We define the sum-product function for base to be the following:
where is the number of digits in the number in base , and
is the value of each digit of the number. A natural number is a sum-product number if it is a fixed point for , which occurs if . The natural numbers 0 and 1 are trivial sum-product numbers for all , and all other sum-product numbers are nontrivial sum-product numbers.
For example, the number 144 in base 10 is a sum-product number, because , , and .
A natural number is a sociable sum-product number if it is a periodic point for , where for a positive integer , and forms a cycle of period . A sum-product number is a sociable sum-product number with , and a amicable sum-product number is a sociable sum-product number with .
All natural numbers are preperiodic points for , regardless of the base. This is because for any given digit count , the minimum possible value of is and the maximum possible value of is . The maximum possible digit sum is therefore and the maximum possible digit product is . Thus, the sum-product function value is . This suggests that , or dividing both sides by , . Since , this means that there will be a maximum value where , because of the exponential nature of and the linearity of . Beyond this value , always. Thus, there are a finite number of sum-product numbers, and any natural number is guaranteed to reach a periodic point or a fixed point less than , making it a preperiodic point.
The number of iterations needed for to reach a fixed point is the sum-product function's persistence of , and undefined if it never reaches a fixed point.
Any integer shown to be a sum-product number in a given base must, by definition, also be a Harshad number in that base.
Sum-product numbers and cycles of Fb for specific b
All numbers are represented in base .
|Base||Nontrivial sum-product numbers||Cycles|
2 → 11 → 2
22 → 121 → 22
|5||341||22 → 31 → 22|
|7||22, 242, 1254, 2343, 116655, 346236, 424644|
|9||13, 281876, 724856, 7487248||53 → 143 → 116 → 53|
|11||253, 419, 2189, 7634, 82974|
|12||128, 173, 353|
|13||435, A644, 268956|
|14||328, 544, 818C|
|17||33, 3B2, 3993, 3E1E, C34D, C8A2|
|18||175, 2D2, 4B2|
|19||873, B1E, 24A8, EAH1, 1A78A, 6EC4B7|
|20||1D3, 14C9C, 22DCCG|
|22||24, 366C, 6L1E, 4796G|
|23||7D2, J92, 25EH6|
|25||15, BD75, 1BBN8A|
|26||81M, JN44, 2C88G, EH888|
|31||44, 13H, 1E5|
|34||25Q8, 16L6W, B6CBQ|
|37||15Z7, 1DJ7, 557V|
|40||0, 1, Ha1O|
Extension to negative integers
Sum-product numbers can be extended to the negative integers by use of a signed-digit representation to represent each integer.
def sum_product(x: int, b: int) -> int: """Sum-product number.""" sum_x = 0 product = 1 while x > 0: if x % b > 0: sum_x = sum_x + x % b product = product * (x % b) x = x // b return sum_x * product def sum_product_cycle(x: int, b: int) -> List[int]: seen =  while x not in seen: seen.append(x) x = sum_product(x, b) cycle =  while x not in cycle: cycle.append(x) x = sum_product(x, b) return cycle
- Arithmetic dynamics
- Dudeney number
- Happy number
- Kaprekar's constant
- Kaprekar number
- Meertens number
- Narcissistic number
- Perfect digit-to-digit invariant
- Perfect digital invariant
- Proof that number of sum-product numbers in any base is finite, PlanetMath. Archived 2013-05-09 at the Wayback Machine by Raymond Puzio