Skip to content
Surf Wiki
Save to docs
general/arithmetic-dynamics

From Surf Wiki (app.surf) — the open knowledge base

Sum-product number

Number equal to the product of the sum and product of its digits


Number equal to the product of the sum and product of its digits

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

There are a finite number of sum-product numbers in any given base b. In base 10, there are exactly four sum-product numbers : 0, 1, 135, and 144.

Definition

Let n be a natural number. We define the sum-product function for base b 1, F_b : \mathbb{N} \rightarrow \mathbb{N}, to be the following: : F_b(n) = \left(\sum_{i = 1}^k d_i\right)!!\left(\prod_{j = 1}^k d_j\right) where k = \lfloor \log_b{n} \rfloor + 1 is the number of digits in the number in base b, and : d_i = \frac{n \bmod{b^{i+1}} - n \bmod b^i}{b^i} is the value of each digit of the number. A natural number n is a sum-product number if it is a fixed point for F_b, which occurs if F_b(n) = n. The natural numbers 0 and 1 are trivial sum-product numbers for all b, 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 1 + 4 + 4 = 9, 1 \times 4 \times 4 = 16, and 9 \times 16 = 144.

A natural number n is a sociable sum-product number if it is a periodic point for F_b, where F_b^p(n) = n for a positive integer p, and forms a cycle of period p. A sum-product number is a sociable sum-product number with p = 1, and an amicable sum-product number is a sociable sum-product number with p = 2.

All natural numbers n are preperiodic points for F_b, regardless of the base. This is because for any given digit count k, the minimum possible value of n is b^{k-1} and the maximum possible value of n is b^k - 1 = \sum_{i=0}^{k-1} (b-1)^i. The maximum possible digit sum is therefore k(b-1) and the maximum possible digit product is (b-1)^k. Thus, the sum-product function value is F_b(n) = k(b-1)^{k+1}. This suggests that k(b-1)^{k+1} \geq n \geq b^{k-1}, or dividing both sides by (b-1)^{k-1}, k(b-1)^2 \geq {\left(\frac{b}{b-1}\right)}^{k-1}. Since \frac{b}{b-1} \geq 1, this means that there will be a maximum value k where {\left(\frac{b}{b-1}\right)}^k \leq k(b-1)^2, because of the exponential nature of {\left(\frac{b}{b-1}\right)}^k and the linearity of k(b-1)^2. Beyond this value k, F_b(n) \leq n 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 b^k - 1, making it a preperiodic point.

The number of iterations i needed for F_b^i(n) to reach a fixed point is the sum-product function's persistence of n, 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 ''F''''b'' for specific ''b''

All numbers are represented in base b.

BaseNontrivial sum-product numbersCycles
2(none)(none)
3(none)2 → 11 → 2, 22 → 121 → 22
412(none)
534122 → 31 → 22
6(none)(none)
722, 242, 1254, 2343, 116655, 346236, 424644
8(none)
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\varnothing
2815B
29\varnothing
30976, 85MDA
3144, 13H, 1E5
32\varnothing
331KS69, 54HSA
3425Q8, 16L6W, B6CBQ
354U5W5
3616, 22O

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

References

References

  1. {{Cite OEIS
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about Sum-product number — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report