[go: up one dir, main page]

login
A372029
For a positive number k, let L(k) denote the list consisting of k followed by the prime factors of k, with repetition, in nondecreasing order; sequence gives composite k such that the digits of L(k) are in nondecreasing order.
9
12, 25, 35, 111, 112, 125, 222, 245, 333, 335, 445, 1225, 2225, 11125, 33445, 334445, 3333335, 3334445, 3444445, 33333445, 333333335, 334444445, 3333333335, 33333334445, 333333333335, 33333333334445, 33333333444445, 444444444444445, 2222222222222225, 11111111111111125
OFFSET
1,1
COMMENTS
Terms cannot end in 4, 6, 8, or 9 because 2 would be a factor and no prime consists entirely of 9's. - Michael S. Branicky, Apr 22 2024
EXAMPLE
The initial terms and their factorizations are:
12 = [2, 2, 3]
25 = [5, 5]
35 = [5, 7]
111 = [3, 37]
112 = [2, 2, 2, 2, 7]
125 = [5, 5, 5]
222 = [2, 3, 37]
245 = [5, 7, 7]
333 = [3, 3, 37]
335 = [5, 67]
445 = [5, 89]
1225 = [5, 5, 7, 7]
2225 = [5, 5, 89]
11125 = [5, 5, 5, 89]
33445 = [5, 6689]
334445 = [5, 66889]
3333335 = [5, 666667]
3334445 = [5, 666889]
3444445 = [5, 688889]
33333445 = [5, 6666689]
333333335 = [5, 66666667]
334444445 = [5, 66888889]
...
12 is a term since the list L(12) is [12,2,2,3], in which the digits 1,2,2,2,3 are in nondecreasing order.
121 is not a term since L(121) = [121,11,11], and the digits 1,2,1,1,1,1,1 are not in nondecreasing order.
PROG
(Python)
from sympy import factorint, isprime
def nd(s): return sorted(s) == list(s)
def ok(n):
if n < 4 or isprime(n): return False
s, f = str(n), "".join(str(p)*e for p, e in factorint(n).items())
return nd(s+f)
print([k for k in range(10**5) if ok(k)]) # Michael S. Branicky, Apr 22 2024
(Python) # faster for initial segment of sequence
from sympy import factorint, isprime
from itertools import count, islice, combinations_with_replacement as mc
def nd(s): return s == "".join(sorted(s))
def bgen(d): # can't end in 8 or 9
yield from ("".join(m) for m in mc("1234567", d))
def agen(): # generator of terms
for d in count(2):
for s in bgen(d):
t = int(s)
if any(s[-1] > c and t%int(c) == 0 for c in "2357"): continue
if isprime(t): continue
if nd(s+"".join(str(p)*e for p, e in factorint(t).items())):
yield t
print(list(islice(agen(), 25))) # Michael S. Branicky, Apr 22 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Apr 16 2024
EXTENSIONS
a(25) and beyond from Michael S. Branicky, Apr 22 2024
STATUS
approved