Sum-product number

A sum-product number in a given number base b {\displaystyle 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 {\displaystyle b} . In base 10, there are exactly four sum-product numbers (sequence A038369 in the OEIS): 0, 1, 135, and 144.[1]

Definition

Let n {\displaystyle n} be a natural number. We define the sum-product function for base b > 1 {\displaystyle b>1} , F b : N N {\displaystyle F_{b}:\mathbb {N} \rightarrow \mathbb {N} } , to be the following:

F b ( n ) = ( i = 1 k d i ) ( j = 1 k d j ) {\displaystyle F_{b}(n)=\left(\sum _{i=1}^{k}d_{i}\right)\!\!\left(\prod _{j=1}^{k}d_{j}\right)}

where k = log b n + 1 {\displaystyle k=\lfloor \log _{b}{n}\rfloor +1} is the number of digits in the number in base b {\displaystyle b} , and

d i = n mod b i + 1 n mod b i b i {\displaystyle 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 {\displaystyle n} is a sum-product number if it is a fixed point for F b {\displaystyle F_{b}} , which occurs if F b ( n ) = n {\displaystyle F_{b}(n)=n} . The natural numbers 0 and 1 are trivial sum-product numbers for all b {\displaystyle 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 {\displaystyle 1+4+4=9} , 1 × 4 × 4 = 16 {\displaystyle 1\times 4\times 4=16} , and 9 × 16 = 144 {\displaystyle 9\times 16=144} .

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

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

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

All numbers are represented in base b {\displaystyle b} .

Base Nontrivial sum-product numbers Cycles
2 (none) (none)
3 (none) 2 → 11 → 2, 22 → 121 → 22
4 12 (none)
5 341 22 → 31 → 22
6 (none) (none)
7 22, 242, 1254, 2343, 116655, 346236, 424644
8 (none)
9 13, 281876, 724856, 7487248 53 → 143 → 116 → 53
10 135, 144
11 253, 419, 2189, 7634, 82974
12 128, 173, 353
13 435, A644, 268956
14 328, 544, 818C
15 2585
16 14
17 33, 3B2, 3993, 3E1E, C34D, C8A2
18 175, 2D2, 4B2
19 873, B1E, 24A8, EAH1, 1A78A, 6EC4B7
20 1D3, 14C9C, 22DCCG
21 1CC69
22 24, 366C, 6L1E, 4796G
23 7D2, J92, 25EH6
24 33DC
25 15, BD75, 1BBN8A
26 81M, JN44, 2C88G, EH888
27 {\displaystyle \varnothing }
28 15B
29 {\displaystyle \varnothing }
30 976, 85MDA
31 44, 13H, 1E5
32 {\displaystyle \varnothing }
33 1KS69, 54HSA
34 25Q8, 16L6W, B6CBQ
35 4U5W5
36 16, 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

See also

References

  1. ^ Sloane, N. J. A. (ed.). "Sequence A038369 (Numbers n such that n = (product of digits of n) * (sum of digits of n).)". The On-Line Encyclopedia of Integer Sequences. OEIS Foundation.
  • v
  • t
  • e
Classes of natural numbers
Of the form a × 2b ± 1
Other polynomial numbers
Recursively defined numbers
Possessing a specific set of other numbers
Expressible via specific sums
2-dimensional
centered
non-centered
3-dimensional
centered
non-centered
pyramidal
4-dimensional
non-centered
Combinatorial numbers
Divisor functions
Prime omega functions
Euler's totient function
Aliquot sequences
Primorial
Numeral system-dependent numbers
Arithmetic functions
and dynamics
Digit sum
Digit product
Coding-related
Other
P-adic numbers-related
Digit-composition related
Digit-permutation related
Divisor-related
Other
Generated via a sieve
  • Mathematics portal