Showing posts with label NotebookLM. Show all posts
Showing posts with label NotebookLM. Show all posts

Tuesday, 24 March 2026

Digit Manipulation


Video created by NotebookLM based on blog content

DIGITS TO SQUARES

Yesterday I turned 28113 days old and this number is a member of OEIS A048383: numbers \(k\) such that replacing each nonzero digit \(d\) with the \(d\)-th prime (replacing each 0 digit with a 1) yields a square. So this means that:$$28113 \rightarrow 319225 = 5^2 \times 113^2$$The members of this sequence are few and far between and in the range up to 40000 only the following numbers satisfy (permalink):$$ \begin{align} 0 &\rightarrow 1 = 1\\13 &\rightarrow 25 = 5^2\\113 &\rightarrow 225 = 3^2 \times 5^2\\2410 &\rightarrow 3721 = 61^2\\4113 &\rightarrow 7225 = 5^2 \times 17^2\\6113 &\rightarrow 13225 = 5^2 \times 23^2\\8210 &\rightarrow 19321 = 139^2\\14113 &\rightarrow 27225 = 3^2 \times 5^2 \times 11^2\\23410 &\rightarrow 35721 = 3^6 \times 7^2\\28113 &\rightarrow 319225 = 5^2 \times 113^2\\33113 &\rightarrow 55225 = 5^2 \times 47^2\\34010 &\rightarrow 57121 = 239^2\\35113 &\rightarrow 511225 = 5^2 \times 11^2 \times 13^2\\\end{align}$$DIGITS TO PRIMES

A variation on this theme is OEIS A048381:


A048381: numbers \(k\) such that replacing each nonzero digit \(d\) with the \(d\)-th prime (replacing each 0 digit with a 1) yields a prime.

Members of this sequence are far more numerous with 5629 in the range up to 40000. An example is 28112 since:$$28112 \rightarrow 319223 \text{ which is prime} $$Some upcoming members are:

28124, 28146, 28152, 28155, 28202, 28210, 28214, 28216, 28226, 28228, 28230, 28234, 28235, 28236, 28247, 28265, 28270, 28277, 28289, 28294, 28295, 28298, 28300, 28317, 28319, 28328, 28329, 28344, 28359, 28360, 28368, 28388, 28392, 28397, 28414, 28418, 28422, 28429, 28434, 28449, 28458, 28464, 28470, 28474, 28485, 28490, 28498, 28502, 28504, 28515, 28524, 28525, 28529, 28546, 28562, 28575, 28592, 28599, 28606, 28612, 28614, 28622, 28630, 28652, 28658, 28665, 28667, 28674, 28684, 28686, 28706, 28717, 28724, 28744, 28752, 28772, 28786, 28807, 28810, 28814, 28825, 28827, 28838, 28854, 28868, 28870, 28876, 28886, 28888, 28890, 28928, 28929, 28932, 28948, 28955, 28960, 28966, 28979, 28984, 28988, 28995, 28997

One way to thin the numbers when there are so many in a given range is to require that the numbers come in pairs that are consecutive integers. If this requirement is imposed then the 5629 reduces to 580. Imposing the restriction that the numbers are triplets that are consecutive integers reduces the 580 further to a manageable 103:

1, 2, 3, 4, 5, 6, 7, 24, 25, 144, 166, 167, 414, 474, 506, 674, 897, 898, 1026, 1027, 1176, 1177, 1398, 1516, 1824, 2035, 2074, 2094, 2146, 2544, 3316, 4044, 5247, 5248, 5286, 5514, 6044, 6484, 7116, 7117, 7118, 7264, 7918, 8008, 8127, 8444, 8665, 10016, 11046, 11047, 11404, 13068, 13445, 14224, 14584, 15886, 16055, 16346, 16347, 16505, 16945, 18306, 18497, 19276, 19465, 20044, 20124, 21797, 21798, 22167, 22416, 22417, 22586, 22694, 22767, 23336, 23774, 24726, 24727, 24845, 25934, 26608, 26844, 26885, 28234, 29376, 29377, 29714, 29715, 29917, 30145, 30705, 32244, 32248, 33807, 35405, 35647, 36018, 36635, 37888, 38097, 39067, 39527

Let's take 28234 as an example where:$$ \begin{align} 28234 &\rightarrow 319357\\28235 &\rightarrow 3193511\\28236 &\rightarrow 3193513 \end{align}$$There is of course an initial run of seven numbers (1 to 7) and after that there are runs of four numbers beginning with:

24, 166, 897, 1026, 1176, 5247, 7116, 7117, 11046, 16346, 21797, 22416, 24726, 29376, 29714

Finally there is only one run of five numbers and it starts with 7116.

DIGITS TO PALINDROMES

Another variation, using this same method of digit manipulation, is to ask what non-palindromic number become palindromes. Well, in the range up to 40000, it turns out that 333 numbers satisfy this condition (permalink). The numbers from 28113 onwards are:

28086, 28586, 28686, 28786, 28802, 28886, 29029, 29069, 29129, 29199, 29212, 29229, 29329, 29429, 29529, 29569, 29612, 29669, 29769, 29869, 29912, 29999, 30053, 30553, 30653, 30753, 30853, 32063, 32193, 32563, 32663, 32763, 32863, 32993, 34073, 34573, 34673, 34773, 34873, 35003, 35503, 36203, 36603, 36903, 37403, 37703, 38803, 39213, 39613, 39913

Let's use 28086 as an example:$$28086 \rightarrow 31911913$$Clearly there are many possible variations using just this particular type of digit manipulation and in this post I've shown examples of three of them where the digits \(d\) are manipulated as follows:$$ \begin{align} d &\rightarrow \text{ prime}(d) \text{ if } d \neq 0 \\0 &\rightarrow 1 \end{align} $$However, other manipulations are limited only by your imagination. An example of different type of manipulation would be:$$ d \rightarrow d^{ \, \small{2}}$$We can ask how many non-palindromic numbers become palindromes when their digits are manipulated in this manner (squared). In the range up to 40000, the answer is that there are 96 suitable numbers and they are (permalink):

19, 28, 37, 41, 72, 199, 288, 327, 377, 441, 461, 732, 772, 1191, 1281, 1371, 1411, 1721, 1919, 1999, 2192, 2282, 2372, 2412, 2722, 2828, 2888, 3193, 3207, 3217, 3227, 3237, 3283, 3373, 3413, 3723, 3737, 3777, 4141, 4441, 4661, 7032, 7132, 7232, 7272, 7332, 7772, 11991, 12881, 13271, 13771, 14411, 14611, 17321, 17721, 19019, 19119, 19219, 19319, 19999, 21992, 22882, 23272, 23772, 24412, 24612, 27322, 27722, 28028, 28128, 28228, 28328, 28888, 31993, 32007, 32117, 32197, 32227, 32287, 32337, 32377, 32417, 32727, 32883, 33273, 33773, 34413, 34613, 37037, 37137, 37237, 37277, 37323, 37337, 37723, 37777

An example is 28028 where$$28028 \rightarrow 4640464$$

Thursday, 1 January 2026

A Formidable Run Of Hidden Beast Numbers

Today marks the start of a remarkable run of diurnal age numbers constituting what I call \( \textbf{hidden beast numbers} \) that I discussed in a post titled More Hidden Beast Numbers. These are numbers that contain the digit sequence "666" when expressed in a non-decimal base. In the case of my diurnal age today (28032) and the run of numbers to come, that base is 8. Here is the run and as can be seen it contains runs of "6666" and even "66666":

28032 --> 66600
28033 --> 66601
28034 --> 66602
28035 --> 66603
28036 --> 66604
28037 --> 66605
28038 --> 66606
28039 --> 66607
28040 --> 66610
28041 --> 66611
28042 --> 66612
28043 --> 66613
28044 --> 66614
28045 --> 66615
28046 --> 66616
28047 --> 66617
28048 --> 66620
28049 --> 66621
28050 --> 66622
28051 --> 66623
28052 --> 66624
28053 --> 66625
28054 --> 66626
28055 --> 66627
28056 --> 66630
28057 --> 66631
28058 --> 66632
28059 --> 66633
28060 --> 66634
28061 --> 66635
28062 --> 66636
28063 --> 66637
28064 --> 66640
28065 --> 66641
28066 --> 66642
28067 --> 66643
28068 --> 66644
28069 --> 66645
28070 --> 66646
28071 --> 66647
28072 --> 66650
28073 --> 66651
28074 --> 66652
28075 --> 66653
28076 --> 66654
28077 --> 66655
28078 --> 66656
28079 --> 66657
28080 --> 66660
28081 --> 66661
28082 --> 66662
28083 --> 66663
28084 --> 66664
28085 --> 66665
28086 --> 66666
28087 --> 66667
28088 --> 66670
28089 --> 66671
28090 --> 66672
28091 --> 66673
28092 --> 66674
28093 --> 66675
28094 --> 66676
28095 --> 66677

The end of the run, 28095, falls on March 5th 2026. 

Here is an infographic that summarises some of the information about hidden beast numbers.


Figure 1: generated by NotebookLM

Tuesday, 9 December 2025

The Cantor Ternary Set Revisited

It was back in January 2nd of 2022 (almost four years ago now) that I posted about The Cantor Ternary Set. I began the post with the following statement:

Today I turned 26572 days old and discovered that \( \dfrac{1}{26572} \) is in the Cantor set.


Infographic created using NotebookLM

In the context of the Cantor ternary set, 26572 is referred to as a \( \textbf{primitive} \) number and as such belongs to OEIS A173793. These numbers are not multiples of 3 as some of the other numbers are that belong in this set. The next such number is \( \textbf{28009} \), my diurnal age today. The initial members of this sequence are:

1, 4, 10, 13, 28, 40, 82, 91, 121, 244, 328, 364, 730, 757, 820, 949, 1036, 1093, 2188, 2362, 2812, 2920, 3280, 6562, 6643, 7381, 9490, 9841, 19684, 20440, 26248, 26572, 28009, 29524, 59050, 59293, 63973, 65620, 66124, 66430, 84253, 88573, 177148

As can be seen, after 28009, there is only one other number that I'm likely to experience in my lifetime and that is 29524. However if we include numbers in the Cantor set that are multiples of 3 then there are many more terms and these constitute OEIS A121153. Between 26572 and 29524, we have the following numbers as shown in Table 1 where the numbers (primitive and non-primitive) are shown together with their factorisations and the representation of their reciprocals in ternary format:


Table 1: permalink

For the non-primitive numbers, the factor of 3 is recurrent whereas in the primitive numbers it is absent. Here is a link to a video (uploaded to YouTube) that I got NotebookLM to create for me about the Cantor ternary set and below is the video:

Monday, 1 December 2025

The Secret Destiny of Numbers


It was only very early this morning that I created a post titled Revisiting the Odd (+) and Even (-) Algorithm and in it I mentioned the PDF file that I had uploaded to Academia. In this post I've embedded the video (located on YouTube) that NotebookLM created based on this PDF. It did a really good job of energising the content and presenting it in a novel and exciting way. Once again I'm impressed and looking forward to generating more videos from my store of over 900 mathematical blog posts.

Friday, 27 June 2025

SageMath: Number Theory and Algorithms

I used Google's NotebookLM to upload all my SageMath documents. Here was the summary it provided of the 27 sources that I provided:

These SageMath excerpts explore various mathematical concepts and algorithms. They present definitions and computational methods for topics such as balanced primes, factorial and p-adic number bases, and Bell numbers. The texts also investigate number theory problems, including palindrome properties, divisibility rules, and prime number sequences like those found in OEIS (Online Encyclopedia of Integer Sequences). Furthermore, the sources cover graph theory applications with dictionaries, geometric concepts like Dyck paths, and calculations involving mathematical constants like Pi and the Golden Ratio. Finally, they illustrate probabilistic simulations and the use of plotting functions within the SageMath environment.

*********************************

I then asked the following question:

Can you summarise what the sources have to say about matters relating prime numbers?

Here was the response:

The sources provide a comprehensive overview of various aspects related to prime numbers, their definitions, properties, classifications, and applications within SageMath.

Here's a summary of what the sources say about matters relating to prime numbers:

Basic Definitions and Concepts
  • A prime number is frequently identified using the is_prime() function in SageMath, which returns True if a number is prime and False otherwise.
  • The distinct prime factors of a number n are given by prime_factors(n) or prime_divisors(n).
  • The total number of prime factors counted with multiplicity is referred to as bigomega(n) or Ω(n), which can be found using sloane.A001222 or by summing the exponents from list(factor(n)).
  • The number of different prime divisors of n is called omega(n) or ω(n), available through sloane.A001221 or len(prime_divisors(n)).
  • To see all prime factors with their powers, the factor() command is used, which returns a factored form or a list of (base, index) pairs.
Types of Prime Numbers

The sources define and provide algorithms for various special types of prime numbers:

  • Balanced Primes: A prime number is balanced if it is the average of an equal number of primes above and below it. An algorithm generates balanced primes of a given order within a range.
  • Cuban Primes: Primes that are the difference of two consecutive cubes.
  • Emirps: A prime number that remains prime when its digits are reversed (e.g., 17 and 71). This concept can be generalized to n-almost primes.
  • Luhn Primes: Primes where the sum of the prime and its reverse (or their powers) is also a prime. Orders 1, 2, and 4 are mentioned, with algorithms provided for any order, though results are assured only for orders 1, 2, and 4.
  • Quintan Primes: Primes of the form (x^5 - y^5) / (x - y).
  • Twin Primes: A pair of primes that differ by 2 (e.g., (26111, 26113)). An algorithm lists them in a given range. The twin prime constant is also listed.
  • Truncatable Primes:
    • Left Truncatable Primes: Generated by successively removing digits from the left (e.g., 5372126317, where 12 needs to be added to the front for the next prime). Algorithms are provided for sequences starting from 3 or 7.
    • Right Truncatable Primes: Generated by successively removing digits from the right (e.g., 31193 -> 3119 -> 311 -> 31 -> 3). Algorithms are provided for sequences starting from 3 or 5.
  • Carmichael Numbers: Composite numbers that satisfy k^(n-1) ≡ 1 (mod n) for all k coprime to n. They are a special case of n-Knödel numbers where the subscript is 1. The smallest Carmichael number is 561.
  • Pseudoprimes:
    • Fermat Pseudoprimes: Composite numbers x that pass the Fermat primality test for a given base b, meaning b^(x-1) % x == 0 (where b is coprime to x).
    • Strong Fermat Pseudoprimes: Composite numbers that pass an additional, stronger primality test.
    • Euler Pseudoprimes: Odd composite integers n that satisfy a^((n-1)/2) ≡ ±1 (mod n) for a coprime to n. Every Euler pseudoprime is also a Fermat pseudoprime. Absolute Euler pseudoprimes are Euler pseudoprimes to every base coprime to themselves, and they are a subset of Carmichael numbers. The smallest absolute Euler pseudoprime is 1729.
  • Almost Primes: Numbers with a specific total count of prime factors (counted with multiplicity).
  • Semiprimes: Numbers that are the product of two primes. Algorithms are provided to generate them and apply them in other contexts, such as finding primes that are the sum of two and three successive semiprimes. A special type is Golden Semiprimes, where the factors p and q satisfy abs(p * phi - q) < 1 (where phi is the golden ratio). This can be generalized to other ratios like HDTV.
  • Sphenic Numbers: Products of three distinct primes. They can occur in pairs and triples, but not more than three consecutive ones. Algorithms generate them and calculate associated properties like surface area and ratio if viewed as rectangular prisms.
  • Ulam Numbers: Defined recursively: U1=1, U2=2. For k>2, Uk is the smallest integer that can be written in exactly one way as Ui + Uj with i < j < k. A list of the first 10,000 Ulam numbers is available, and code demonstrates their unique sum property.
  • Untouchable Numbers: Numbers that cannot be expressed as the sum of the divisors of any other number. ErdÅ‘s proved there are infinitely many. An algorithm helps identify them by excluding numbers that are one or three more than a prime.
  • Euclid Numbers: Integers of the form Pn# + 1, where Pn# is the nth primorial (product of the first n prime numbers).
  • Moran Numbers: A composite number that, when divided by the sum of its digits, results in a prime number.
  • Hoax Numbers: Composite numbers where the sum of their digits equals the sum of the digits of their distinct prime factors. They are a subset of Smith numbers.
  • Smith Numbers: Composite numbers where the sum of their digits equals the sum of the digits of their prime factors (counted with multiplicity).
  • Home Prime: For a number n, its home prime is the prime reached by repeatedly concatenating its prime factors (smallest to largest) until a prime is found. Algorithms determine the home prime and the number of steps required.
  • De Polignac Numbers: Odd numbers that cannot be expressed as 2^k + p for a prime p.
  • Interprime Numbers: Numbers midway between two prime numbers.
  • n-Knödel Numbers: Composite numbers n such that for every k coprime to n, k^(n-subscript) ≡ 1 (mod n). Carmichael numbers are a special case where the subscript is 1.
  • Duffinian Numbers: Numbers that have no factors in common with their sum of divisors.
  • Zumkeller Numbers and Half-Zumkeller Numbers: Numbers whose divisors can be partitioned into two disjoint sets with equal sums.
Prime-Related Algorithms and Applications in SageMath
  • Generating Primes: prime_range(start, end) generates primes within a specified range.
  • Prime Indexing: prime_pi(n) gives the count of primes less than or equal to n (with 2 being the 1st prime). Primes().unrank(k) gives the k-th prime (with 2 being the 0th prime), while nth_prime(k) gives the k-th prime (with 2 being the 1st prime).
  • Consecutive Primes: next_prime(p) and previous_prime(p) find adjacent primes.
  • Prime Gaps: Algorithms determine and track record prime gaps (the difference between consecutive primes).
  • Density of Primes: An algorithm investigates the density of primes based on the number of digits, showing an approximately constant product of percentage of primes and number of digits.
  • Goldbach Conjecture/Decomposition/Partition: Goldbach's conjecture states every even number greater than 2 is a sum of two primes. Algorithms find the number of decompositions and the minimal decomposition. The conjecture is also extended to lucky numbers.
  • Euler Project Problem 50: An algorithm is provided to find the prime below one million that can be written as the sum of the most consecutive primes (which is 997651, sum of 543 consecutive primes).
  • Primorials: The product of the first n primes can be generated and used as a mixed radix number base.
  • Sum of Prime Factors with Multiplicity: This operation can be iterated until a 4 or a prime number is reached, with some numbers requiring many steps.
  • Numbers as Sums of Cubes of Distinct Primes: An algorithm identifies primes that are the sum of cubes of three distinct prime numbers.
  • Connections to Pi: Algorithms are provided to find primes by merging successive digits from the decimal expansion of Pi or Pi squared.
  • Ruth-Aaron Pairs & eRAPs: Algorithms identify pairs of consecutive integers that share the same sum of prime factors (either distinct or counted with multiplicity). An extension, eRAPs, considers consecutive numbers where the sums of their prime factors (with multiplicity) are consecutive.
  • Prime Attractors: In the "Odds and Evens" recursive process (adding sum of odd digits, subtracting sum of even digits), some numbers lead to attractors, and algorithms can identify prime attractors.
  • Dates and Primes: An algorithm checks if a person's age in days on their birthday is a prime number. Another algorithm identifies dates that correspond to prime numbers in a given year.
  • Palindromes and Primes: Algorithms identify composite palindromes whose sum of prime factors (with multiplicity) is also palindromic, and to list prime palindromes within a range.
  • Sum of Cubes and Primes: An algorithm identifies twin primes that are both expressible as the sum of three cubes.
  • Divisors and Coprimality: The gcd() function is used for various calculations, including identifying unitary divisors and Carmichael numbers. n.coprime_integers(m) returns integers less than m that are coprime to n.
  • Modular Arithmetic: The IntegerModRing() function allows for computations in modular arithmetic, essential for primality tests and properties of numbers modulo n.
  • Multipurpose Algorithm: A single algorithm can perform multiple number theory checks on a given number, including primality tests, factorisation, sum of divisors, pseudoperfectness, Zumkeller status, practicality, Duffinian nature, cyclicity, d-powerful property, sum of squares/cubes of digits, and de Polignac property.
OEIS Sequences Related to Primes

Many algorithms are designed to generate terms for specific OEIS (Online Encyclopedia of Integer Sequences) sequences related to primes and prime-derived numbers:

  • A002858: Ulam numbers.
  • A048168: n is divisible by the square of the number of unitary divisors of n.
  • A064599: Sum of non-unitary divisors of n divides n.
  • A129485: Odd unitary abundant numbers.
  • A005114: Untouchable numbers.
  • A048128: Numbers becoming prime or 4 after exactly 6 iterations of f(x) = sum of prime factors of x.
  • A002407: Cuban primes.
  • A137365: Prime numbers n such that n = p1^3 + p2^3 + p3^3, a sum of cubes of 3 distinct primes.
  • A138938: Indices k such that cyclotomic_polynomial(k, 8) is prime.
  • A003635: Inconsummate numbers.
  • A046411: Composite numbers where the concatenation of their prime factors is a prime (single step to home prime).
  • A108540: Golden semiprimes.
  • A255897: Primes equal to the sum of both two and three successive semiprimes.
  • A006558: Start of the first run of n consecutive integers with the same number of divisors.
  • A045983: Numbers k such that n or more consecutive integers starting at k have the same number of distinct prime divisors.
  • A046354: Composite palindromes whose sum of prime factors (with multiplicity) is palindromic.
  • A056215: Primes p for which the period of reciprocal 1/p equals (p-1)/10.
  • A104825 / A104928: Primes from merging successive digits in the decimal expansion of Pi or Pi squared.
  • A048131: Numbers becoming prime or 4 after exactly 9 iterations of f(x) = sum of prime factors of x.
  • A006038: Odd primitive abundant numbers.
  • A005835: Pseudoperfect numbers.
  • A262054: Euler pseudoprimes to base 7.
  • A002649: Quintan primes.
  • A085158 / A289697: Sextuple factorial and numbers k such that k!6 - 24 is prime.
  • A131354: Number of primes in the open interval between successive tribonacci numbers.
  • A053584: Smallest prime ending with a(n), where a(1)=7 (related to left truncatable primes).
  • A000005: The tau function (number of divisors).
  • A270865: Smallest primes of 4x4 semi-magic squares formed from consecutive primes.
  • A038369: Sum-product numbers.

The sources provide algorithms, definitions, and examples, often linking to OEIS for further information. They also highlight the computational challenges of generating very large numbers or sequences in SageMathCell due to timeouts.

*********************************

The NotebookLM provides links to all the items referenced which is quite useful. These are lost in the copy-paste to Blogger. Gemini admits this limitation and it's just another example of Google's lack of support for this blogging platform. Here is the link to the SageMath: Number Theory and Algorithms NotebookLM.