Sum-product number

A sum-product number in a given number base is a natural number that is equal to the product of the sum of its digits and the product of its digits.[1]

Definition

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,[1] 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
3

2 → 11 → 2

22 → 121 → 22

412
534122 → 31 → 22
6
722, 242, 1254, 2343, 116655, 346236, 424644
8
913, 281876, 724856, 748724853 → 143 → 116 → 53
10135, 144
11253, 419, 2189, 7634, 82974
12128, 173, 353
13435, A644, 268956
14328, 544, 818C
152585
1614
1733, 3B2, 3993, 3E1E, C34D, C8A2
18175, 2D2, 4B2
19873, B1E, 24A8, EAH1, 1A78A, 6EC4B7
201D3, 14C9C, 22DCCG
211CC69
2224, 366C, 6L1E, 4796G
237D2, J92, 25EH6
2433DC
2515, BD75, 1BBN8A
2681M, JN44, 2C88G, EH888
27
2815B
29
30976, 85MDA
3144, 13H, 1E5
32
331KS69, 54HSA
3425Q8, 16L6W, B6CBQ
354U5W5
3616, 22O
3715Z7, 1DJ7, 557V
384HK4, 26Nb6
39
400, 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.

Programming example

The example below implements the sum-product function described in the definition above to search for sum-product numbers and cycles in Python.

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
gollark: Odd.
gollark: Hmm. Someone seriously offered a 9G lyrical tinsel hatchling.
gollark: I can breed a 2G one, possibly.
gollark: Browns are most common?
gollark: Coppers *at that precise stage of cracking* *with that precise color* are probably rarer than CB golds!

See also

References

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.