Tuesday, 13 October 2026

Beyond 23

The algorithm that I got Gemini to create and that I used in the post 23 Revisited was the result of the following prompt:

Write a program in SageMath that determines all the composite, positive integers in a given range that contain the digits 2 and 3 in ascending order from left to right (but not necessarily consecutively) and whose prime factors also all contain the digits 2 and 3 in ascending order but not necessarily consecutively. The default range can be from 1 to 40000. The output should a table showing number and factors followed by a comma-separated list of the qualifying numbers.

Instead of the prime 23, other prime numbers can be investigated. Composite numbers could be investigated too but this would lead to rather large numbers and so I'll restrict this investigation to prime numbers but I'll increase the range from 1 to one million.

Here are the results for 11 (permalink):

Number       | Prime Factors
------------------------------
110231       | 11, 911
111221       | 11, 10111
112321       | 11, 10211
117821       | 11, 10711
128711       | 11, 11701
129811       | 11, 11801
131153       | 11, 11923
131197       | 11, 11927
171121       | 211, 811
211321       | 11, 19211
231121       | 11, 21011
232111       | 11, 21101
261143       | 113, 2311
351119       | 311, 1129
451121       | 11, 41011
511621       | 11, 46511
781121       | 11, 71011
892111       | 11, 81101

Here are the results for 13 (permalink):

Number       | Prime Factors
------------------------------
13169         | 13, 1013
16913         | 13, 1301
22139         | 13, 131
113269       | 13, 8713
131729       | 13, 10133
131807       | 13, 10139
132703       | 131, 1013
134069       | 13, 10313
136669       | 13, 10513
137069       | 113, 1213
137969       | 13, 10613
138781       | 137, 1013
147013       | 113, 1301
161369       | 13, 12413
169013       | 13, 13001
171301       | 13, 13177
171379       | 13, 13183
172133       | 13, 13241
180713       | 13, 13901
190013       | 139, 1367
211303       | 131, 1613
313469       | 13, 24113
313729       | 13, 24133
313781       | 13, 24137
360139       | 13, 2131
407213       | 313, 1301
413473       | 313, 1321
421369       | 13, 32413
661369       | 313, 2113
797513       | 613, 1301
813397       | 13, 4813
813451       | 613, 1327

Here are the results for 17 (permalink):

Number       | Prime Factors
------------------------------
51731         | 17, 179
117589       | 17, 6917
173009       | 17, 10177
178313       | 17, 617
198917       | 17, 11701
217843       | 179, 1217
291703       | 17, 17159
295817       | 17, 17401
301733       | 17, 17749
308417       | 179, 1723
351713       | 17, 1217
368917       | 17, 21701
506617       | 17, 1753
517021       | 17, 1789
541753       | 317, 1709
717043       | 17, 42179

Here, and finally, are the results for 19 (permalink):

Number       | Prime Factors
------------------------------
19361         | 19, 1019
36119         | 19, 1901
119467       | 193, 619
121943       | 197, 619
193667       | 19, 10193
194629       | 191, 1019
196667       | 193, 1019
251929       | 191, 1319
361019       | 19, 19001
361969       | 19, 19051
366719       | 19, 19301
370519       | 19, 19501
371963       | 19, 19577
376219       | 19, 19801
381947       | 193, 1979
519329       | 191, 2719
601967       | 193, 3119
714419       | 19, 1979
719473       | 19, 1993
752419       | 19, 199
796519       | 419, 1901

I won't continue with primes larger than 23 because really what I want is an algorithm that will identify a sequence of digits that form a prime within a number and then check that the same digit sequence occurs with each of its prime factors. The number being checked is thus composite. Here is a permalink to the program that I've now included in my daily number analysis.

No comments:

Post a Comment