Showing posts with label self. Show all posts
Showing posts with label self. Show all posts

Friday, 1 May 2026

Cartesian Product versus Self-Convolution

I asked Gemini the following:

How does the self convolution of a set A differ from the Cartesian product of the set with itself (A x A)?

This was the response: 

To understand the difference between the Cartesian product of a set and its self-convolution, we have to look at what mathematical object each operation produces. In short: the Cartesian product generates a new set of raw pairs, while the convolution generates a sequence that counts the frequencies of their sums.

Here is a full breakdown of how these two concepts differ and how they ultimately connect.

1. The Cartesian Product: Structural Pairing

The Cartesian product of a set $A$ with itself, denoted as $A \times A$, is an operation strictly within set theory.

It takes the elements of $A$ and creates a new set containing every possible ordered pair $(x, y)$, where both $x$ and $y$ are elements of $A$.

$$A \times A = \{(x, y) \mid x \in A \text{ and } y \in A\}$$

    • Nature: It is purely structural. It does not add, multiply, or combine the values of the elements; it merely groups them side-by-side in a 2D grid.
    • Size: If set $A$ contains $k$ elements, the Cartesian product $A \times A$ will always contain exactly $k^2$ elements.

2. The Self-Convolution: Frequency of Sums

Strictly speaking, you cannot convolve a "set" directly; convolution is an operation applied to functions or sequences. When mathematicians refer to the convolution of a set $A$, they are actually referring to the discrete convolution of the set's indicator sequence (also called the characteristic function).

Let $1_A(x)$ be a sequence where the value is $1$ if $x$ is in set $A$, and $0$ if it is not. The self-convolution of this sequence produces a new sequence, $c_n$:

$$c_n = \sum_{i+j=n} 1_A(i) \cdot 1_A(j)$$

    • Nature: It is an arithmetic and combinatorial operation. The resulting sequence $c_n$ tells you exactly how many times the integer $n$ can be expressed as the sum of two elements from set $A$.
    • Size: The result is not a finite set of pairs, but an infinite sequence of integers (though it will be mostly zeros if $A$ is a finite set).

3. The Core Difference

The Cartesian product asks: "What are all the possible ways to pick two elements from this set?"

The Convolution asks: "If I add those two elements together, how many pairs produce a sum of $n$?"

If you imagine the Cartesian product as a square grid of pairs, the convolution is the result of drawing diagonal lines through that grid (where $x + y = n$) and counting how many pairs fall on each diagonal.

4. A Concrete Example

Let’s define a set of integers: $A = \{1, 2, 4\}$

The Cartesian Product ($A \times A$) creates a set of $3^2 = 9$ ordered pairs:

$A \times A = \{(1,1), (1,2), (1,4), (2,1), (2,2), (2,4), (4,1), (4,2), (4,4)\}$

The Self-Convolution maps the sums of these pairs to their frequencies. Let's add the elements of each pair together:

    • Sums to 2: $(1,1) \rightarrow$ 1 pair
    • Sums to 3: $(1,2), (2,1) \rightarrow$ 2 pairs
    • Sums to 4: $(2,2) \rightarrow$ 1 pair
    • Sums to 5: $(1,4), (4,1) \rightarrow$ 2 pairs
    • Sums to 6: $(2,4), (4,2) \rightarrow$ 2 pairs
    • Sums to 7: None $\rightarrow$ 0 pairs
    • Sums to 8: $(4,4) \rightarrow$ 1 pair

The resulting convolution sequence $c_n$ (starting from index $n=0$) would look like this:

$0, 0, 1, 2, 1, 2, 2, 0, 1, 0, 0, 0...$

5. The Generating Function Connection

Because you are working with tools like SageMath, the most elegant way to see the relationship between these two concepts is through generating functions.

If you turn set $A$ into a polynomial where the elements of the set are the exponents, you get:

$$f(x) = x^1 + x^2 + x^4$$

When you square this polynomial (which is the algebraic equivalent of the Cartesian product), you get:

$$f(x)^2 = (x^1 + x^2 + x^4) \cdot (x^1 + x^2 + x^4)$$

$$f(x)^2 = x^2 + 2x^3 + x^4 + 2x^5 + 2x^6 + x^8$$

Look at the coefficients of the expanded polynomial: $1, 2, 1, 2, 2, 1$. These are the exact non-zero values of our convolution sequence. The Cartesian product dictates the terms being multiplied, but the mathematical simplification of gathering like-terms is the act of convolution.

Monday, 31 March 2025

Blast From The Past

Looking back over my old tweets on Twitter (as it was once called), I noticed that my first reference to a day count occurred on August 11th 2013. See Figure 1.


Figure 1

It's a fairly unimpressive tweet that, from a mathematical perspective, simply notes that 23506 has four distinct prime factors. I wasn't aware of the Online Encyclopedia of Integer Sequences or OEIS back then, not Numbers Aplenty or most other resources that I now use. The OEIS informs us that 23506 is a member of A029793:


 A029793    Numbers \(k\) such that \(k\) and \(k^2\) have the same set of digits.


This is because \(23506^2=552532036\) and there are not many numbers in the range up to 40000 that have this property. The numbers that do are: 

0, 1, 10, 100, 1000, 4762, 4832, 10000, 10376, 10493, 11205, 12385, 12650, 14829, 22450, 23506, 24605, 26394, 34196, 36215

From Numbers Aplenty we learn that 23506 has properties that make it
  • a self number because there is no number that added to its sum of digits gives 23506
  • an untouchable number because it is not equal to the sum of proper divisors of any number
My own algorithm tells me that 23506 is:
  • a xenodrome in base 9: 35217 and in base 10: 23506 because all digits are different
  • an attractor because its sum of even and odd digits are the same (8)
These are just a few of the special properties that 23506 possesses. I've come a long way since those early days.

Thursday, 23 May 2024

Simultaneously Inconsummate, Self and Untouchable Numbers

Today I turn 27444 days old and one property of this number is that it is inconsummate, meaning that there is no number that divided by its sum of digits equals 27444. What I noticed however, was that 27111, 27222, 27333, 27444, 27666, 27777, 27888 and 27999 are all inconsummate. 

Notice that 27555 is not inconsummate because 991980, when divided by its sum of digits (36), gives 27555. Similarly 27000 is not inconsummate because 243000, when divided by its sum of digits (9) gives 27000 as does 486000 when divided by its sum of digits (18) etc. The latter result is to be expected because doubling a number produces the same dividend when it is divided by the sum of digits. Similarly, tripling a number produces the same dividend and so any number that is "consummate" has an infinity of numbers that, when divided by their sum of digits, produce the number.

The pattern is less noticeable in the range from 26000 to 26999 where only 26111, 26666 and 26888 are inconsummate. In the range from 28000 to 28999, none of the 28XXX numbers are inconsummate. In the range from 29000 to 29999, we find 29222, 29555 and 29777 to be inconsummate. So the 27000 to 27999 millenium seems to produce one of the highest counts of ABXXX numbers but whether this is the highest, I don't know. In my post titled Inconsummate Numbers from the 1st of August 2018, I provide a list of all inconsummate numbers from 62 to 65535.

Getting back to the number associated with my diurnal age (27444) we find that it is also:

  • a self number, because there is no number that, added to its sum of digits, gives 27444
  • an untouchable number, because it is not equal to the sum of proper divisors of any number
One might reasonably ask the question as to how many numbers are inconsummate, self and untouchable? I was able to identify all the numbers up to 40000 with this property and there are 265 of them. Here they are:

872, 2672, 3752, 3818, 3842, 3864, 4046, 4316, 4338, 4382, 4472, 4494, 4742, 4832, 4854, 4898, 5126, 5148, 5372, 6654, 7284, 7598, 8162, 9152, 9218, 9264, 9848, 10076, 10368, 10379, 10412, 10884, 10974, 11481, 11516, 11549, 12594, 12752, 13226, 13259, 13314, 13382, 13742, 13922, 14126, 14148, 14328, 14394, 14418, 14664, 14754, 14798, 14822, 14934, 14978, 15116, 15215, 15452, 15474, 15507, 15597, 16251, 16811, 17217, 17285, 17544, 17588, 17621, 17757, 18141, 18387, 18422, 18837, 20325, 20514, 20874, 20918, 21392, 22316, 22652, 23214, 23664, 23888, 24722, 24755, 25071, 25104, 25317, 25374, 25418, 25464, 25532, 25622, 25655, 25868, 25901, 26039, 26981, 27029, 27420, 27444, 27611, 28142, 28254, 28377, 28388, 28511, 28737, 28748, 28926, 29165, 29187, 29222, 29244, 29321, 29424, 29435, 29760, 29995, 30337, 30348, 30359, 30449, 30651, 30774, 30998, 31057, 31147, 31237, 31292, 31314, 31428, 31439, 31584, 31707, 31764, 31808, 31832, 31922, 31955, 32025, 32036, 32047, 32069, 32091, 32137, 32159, 32214, 32394, 32418, 32429, 32484, 32552, 32574, 32585, 32618, 32732, 32798, 32822, 32855, 32934, 33037, 33059, 33092, 33114, 33171, 33239, 33698, 33911, 34082, 34374, 34385, 34587, 34655, 34699, 34767, 34925, 34947, 35105, 35151, 35318, 35432, 35454, 35577, 35588, 35621, 35757, 35847, 35880, 35891, 35924, 35948, 35981, 36029, 36095, 36207, 36242, 36264, 36275, 36365, 36398, 36422, 36444, 36455, 36488, 36510, 36567, 36578, 36624, 36635, 36701, 36769, 36791, 36813, 36837, 36848, 36859, 36927, 36949, 36960, 36971, 36993, 37015, 37085, 37175, 37197, 37232, 37265, 37298, 37421, 37434, 37478, 37489, 37535, 37568, 37579, 37623, 37680, 37781, 37803, 37827, 37838, 37871, 37926, 37928, 38005, 38154, 38165, 38220, 38310, 38378, 38525, 38760, 38916, 38927, 39144, 39221, 39537, 39548, 39581, 39671, 39704, 39783, 39851, 39917

So 27444 turns out to be rather special and all such numbers are in a sense quite isolated because they cannot be derived by dividing a number by its sum of digits, nor can they be had by adding the sum of a number's digits to the number and finally they cannot be derived from the addition of the proper divisors of any number. See Bespoken for Sequences entry.

Of the 265 numbers above, 20 of them are prime. These are 11549, 13259, 16811, 26981, 27611, 30449, 31147, 31237, 32069, 32159, 32429, 33037, 33911, 36791, 37489, 37579, 37781, 37871, 39581 and 39671. This is about the number you'd expect by chance, even if it is a little on the low side. There are 54 semiprimes. Of numbers with three consecutive digits that are the same, there are 23888, 27444, 29222, 29995 and 36444.

Tuesday, 29 June 2021

SOD ET AL

SOD stands in a mathematical context for Sum of Digits and it can also be written as SoD or sod. Unlike a number's primeness or non-primeness, a number's SoD is peculiar to the number system being used and is thus of interest mainly in recreational mathematics. My diurnal age today is 26384 with a sum of digits of 23. When these two numbers are added together, the result is a prime number, 26407. This qualifies 26384 for inclusion in OEIS A047791:


 A047791

Numbers \(n\) such that \(n\) plus digit sum of \(n\) (A007953) equals a prime.       


There are 2919 such numbers in the range of numbers from 1 to 26384, constituting about 11.1% of the total number. In the same range, there are 2897 primes and so the totals are nearly identical. This is not surprising because the operation of adding the sum of digits of a number to itself simply changes the number into another number of slightly higher value, without regard to its being prime or composite.


ODDS AND EVENS


Recently, I made a series of posts that involved adding the odd digits to a number and subtracting the even digits. These posts were titled:
I covered a lot of material in those posts so refer to those for more details.


SELF AND JUNCTION NUMBERS

In this post, I want to collect together some of the other mathematical activities that involve the sum of the digits of a number or the manipulation of the digits is some way. Let's start with the concept of a self number. If there does NOT exist a number \(x\) such that \(x\) + sod(\(x\)) = \(n\) for some number \(n\), then \(n\) is said to be a self number. There are 10 self numbers in the range from 26300 to 26400:

26307, 26318, 26320, 26331, 26342, 26353, 26364, 26375, 26386, 26397

Looking at the above numbers, it can be seen that 26308 is not in the list. This is because:

26285 + sod(26285) = 26285 + 23 = 26308

Apart from self numbers, most numbers are like 26385. There is only one value of \(x\) for which \(x\) + sod(\(x\)) = \(n\). If there is more than one value of x then the number is said to be a junction number. In the range from 26300 to 26400, there are nine junction numbers:

26311 is a junction number [26291, 26300]
26313 is a junction number [26292, 26301]
26315 is a junction number [26293, 26302]
26317 is a junction number [26294, 26303]
26319 is a junction number [26295, 26304]
26321 is a junction number [26296, 26305]
26323 is a junction number [26297, 26306]
26325 is a junction number [26298, 26307]
26327 is a junction number [26299, 26308]

Thus we see, using the first number 26311 as an example, that: 
  • 26291 + sod(26291) = 26291 + 20 = 26311 and 
  • 26300 + sod(26300) = 26300 + 11 = 26311
I've written about self and junction numbers in an eponymous post from October 25th 2018. The numbers above give an idea of the relative proportions of such numbers: about 10% are self numbers, 10% are junction numbers and 80% are neither.


HAPPY NUMBERS

Happy numbers don't involve the sum of the digits per se but instead are concerned with the sum of the digits squared. If this process is applied recursively and the end result is 1, then the number is said to be happy. For example, 94 is an example of such a number because:

 94 → 97 → 130 → 10 → 1 

Only about 15% of numbers are happy. The rest end up in a loop (4, 16, 37, 58, 89, 145, 42, 20, 4) and 61 is an example of such a number because:

61 → 37 → 58 → 89 and the loop has been entered

I've written about happy numbers in a series of posts:

SELFIE NUMBERS

I wrote about these sorts of numbers in an eponymous post on March 27th 2020. In it, I quoted the following:
Numbers represented by their own digits by certain operations are considered as selfie numbers. Some times they are called wild narcissistic numbers. There are many ways of representing selfie numbers. They can be represented in digit’s order, reverse order of digits, increasing and/or decreasing order of digits, etc. These can be obtained by use of basis operations along with factorial, squareroot, Fibonacci sequence, Triangular numbers, binomial coefficients, s-gonal values, centered polygonal numbers, etc. In this work, we have written selfie numbers by use of concatenation, along with factorial and square-root. The concatenation idea is used in a very simple way. The work is limited up to 5 digits. Work on higher digits shall be dealt elsewhere. Source.

I use the example of 25926 that can be expressed as: 

((−2+5)!)!×C(9,2)+6 = (3!)! x 36 + 6 = 6! x 36 + 6 = 720 x 36 + 6 = 25926

Another example is \(39304:=((4||03)−9)^3\) where || stands for concatenation.

This is a big topic and it has been covered in detail in my prementioned blog post.


FRIEDMAN NUMBERS

These could be considered a subset of the selfie numbers but they form a category in their own right and are constructed much more simply. I wrote about these in a blog post from October 8th 2020 titled Forming Equations from Integers. To quote:

Consider \(28547=(8+5)^4−(7×2)\) expressed in base 10, both sides use the same digits. An integer is a Friedman number if it can be put into an equation such that both sides use the same digits but the right hand side has one or more basic arithmetic operators (addition, subtraction, multiplication, division, exponentiation) interspersed. Brackets, as usual, are essential to clarify the order of operations. These numbers are named after Erich Friedman, Assoc. Professor of Mathematics at Stetson University. With the help of his students he has researched Friedman numbers in bases 2 through 10 and even with Roman numerals. When both sides use the digits in the same order, the number is called a ”nice” or ”strong” Friedman number. For example, \(3125=(3+[1×2])^5\).


NARCISSISTIC NUMBERS 

Selfie numbers are sometimes called wild narcissistic numbers but the proper narcissistic numbers. Numbers Aplenty defines them thus:

A number \(n\)  of \(k\)  digits is called narcissistic if it is equal to the sum of the \(k^{th}\) powers of its digits. For example, \(153\)  is narcissistic because \(153 = 1^3+5^3+3^3\). Narcissistic numbers are also called Armstrong or plus-perfect numbers. It has verified that there in fact only 88 such numbers. Those up to one million are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725, 4210818, 9800817, 9926315.


D-POWERFUL NUMBERS 

D-powerful numbers are akin to narcissistic numbers but with more flexibility regarding the powers to which the digits may be raised. To quote from Numbers Aplenty:

An integer \(n\) is called digitally powerful (here d-powerful) if it can be expressed as a sum of positive powers of its digits. For example:$$3459872 = 3^1 + 4^6 + 5^5 + 9^6 + 8^3 + 7^7 + 2^{21}$$The first d-powerful numbers are:

1, 2, 3, 4, 5, 6, 7, 8, 9, 24, 43, 63, 89, 132, 135, 153, 175, 209, 224, 226, 262, 264, 267, 283, 332, 333, 334, 357, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 407, 445, 463, 518, 598, 629, 739, 794, 849, 935, 994


HARSHAD AND MORAN NUMBERS 

I've written about Harshad Numbers in the following posts:

In the first of the two posts, I posted from Wikipedia:
In recreational mathematics, a Harshad number (or Niven number) in a given number base, is an integer that is divisible by the sum of its digits when written in that base. Harshad numbers in base n are also known as n-harshad (or n-Niven) numbers. Harshad numbers were defined by D. R. Kaprekar, a mathematician from India. The word "harshad" comes from the Sanskrit hará¹£a (joy) + da (give), meaning joy-giver. The term “Niven number” arose from a paper delivered by Ivan M. Niven at a conference on number theory in 1977. 

They are quite frequent and account for about 12% of all the numbers up to 100,000. Here are the first few:

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42, 45, 48, 50, 54, 60, 63, 70, 72, 80, 81, 84, 90, 100, 102, 108, 110, 111, 112, 114, 117, 120, 126, 132, 133, 135, 140, 144, 150, 152, 153, 156, 162, 171, 180, 190, 192, 195, 198, 200, 201, 204

If the dividend happens to be a prime number then the number is said to be a Moran number. To quote from Numbers Aplenty again:

A number \(n\) is a Moran number if \(n\) divided by the sum of its digits gives a prime number. For example, 111 is a Moran number because 111/(1+1+1) = 37 and 37 is a prime number. Moran numbers are a subset of Harshad numbers. 

The first few Moran numbers are: 

18, 21, 27, 42, 45, 63, 84, 111, 114, 117, 133, 152, 153, 156, 171, 190, 195, 198, 201, 207, 209, 222, 228. 


MAGNANIMOUS NUMBERS

I've written about these in an eponymous post December 27th 2020. To quote from Numbers Aplenty, a magnanimous number can be define as:

A number (which we assume of at least 2 digits) such that the sum obtained inserting a "+" among its digit in any position gives a prime.

For example, 4001 is magnanimous because the numbers 4+001=5, 40+01=41 and 400+1=401 are all prime numbers.

Since all the prime numbers are odd, except for 2, all the magnanimous numbers, except for 11, are either a sequence of odd digits followed by an even digit, or a sequence of even digits followed by an odd digits.

It is conjectured that the magnanimous numbers are finite and that probably the largest one is 97393713331910, while the largest one which is also a prime number itself is probably 608844043.

The first such numbers are:

11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 101, 110, 112, 116, 118, 130, 136, 152, 158, 170, 172, 203 


DIGITAL ROOT 

While I've not made a specific post about digital roots, I've nonetheless mentioned them in the following posts:

To quote from Wikipedia:
The digital root (also repeated digital sum) of a natural number in a given radix is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. In base 10, this is equivalent to taking the remainder upon division by 9 (except when the digital root is 9, where the remainder upon division by 9 will be 0).

Associated with the digital root is the concept of additive persistence defined as:

The additive persistence counts how many times we must sum its digits to arrive at its digital root. For example, the additive persistence of 2718 in base 10 is 2: first we find that 2 + 7 + 1 + 8 = 18, then that 1 + 8 = 9. 


SMITH AND HOAX NUMBERS 

I mentioned Smith numbers in a blog post dating back to April 21st 2016 and titled Repunits and Smith Numbers

Smith numbers are composite numbers with the property that the sum of their digits equals the sum of digits of their prime factors e.g. 22 → 2 + 2 = 4 and 22 = 2 * 11 → 2 + 1 + 1 = 4.

Hoax numbers are similar except they only consider distinct prime factors. Thus, for example, the Smith numbers 4 and 27 are excluded because the sums of their distinct prime factors are 2 and 3 respectively whereas their sums of digits are 4 and 9. The set of hoax numbers is a subset of the set of Smith numbers. 

666 is a Smith number since 666 = 2 * 3 * 3 * 37 and 6 + 6 + 6 = 2 + 3 + 3 + 3 + 7. 

The initial Smith numbers are:

 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438 

The initial hoax numbers are:

22, 58, 84, 85, 94, 136, 160, 166, 202, 234, 250, 265, 274, 308, 319, 336, 346, 355  
 

THE RATS SEQUENCE

I wrote about this in an eponymous post from September 26th 2020. Here is an excerpt:

A sequence produced by the instructions "reverse, add to the original, then sort the digits." For example, after 668, the next iteration is given by

668+866=1534

so the next term is 1345.

Applied to 1, the sequence gives: 

1, 2, 4, 8, 16, 77, 145, 668, 1345, 6677, 13444, 55778, 133345, 666677, 1333444, 5567777, 12333445, 66666677, 133333444, 556667777, 1233334444, 5566667777, 12333334444, 55666667777, 123333334444, 556666667777, 1233333334444, ... (OEIS A004000).

Conway conjectured that an initial number leads to a divergent period-two pattern (such as the above in which the numbers of threes and sixes in the middles of alternate terms steadily increase) or to a cycle (Guy 2004, p. 404).

The lengths of the cycles obtained by starting with n= 1, 2, ... are 0, 0, 8, 0, 0, 8, 0, 0, 2, 0, ... (OEIS A114611), where a 0 indicates that the sequence diverges.