OFFSET
1,2
COMMENTS
LINKS
Kevin Ryde, C Code
FORMULA
a(n) <= a(n-2)*10^k + (a(n-1) - (a(n-2)*10^k mod a(n-1))), where k is the number of decimal digits in a(n-1). - Michael S. Branicky, May 17 2024
EXAMPLE
a(7) = 168912; 16812 = 92*1836 = 92*a(6) and "16812" contains a(5) = 612 as a subsequence.
PROG
(Python)
def subseq(x, y):
i = 0
j = 0
while i != len(x) and j != len(y):
if x[i] == y[j]:
i += 1
j += 1
return i == len(x)
def a(n):
if n == 1:
return 1
A = 1
B = 3
for _ in range(n-2):
s = str(A)
i = 1
while not subseq(s, str(B*i)):
i += 1
A, B = B, B*i
return B
(Python)
from itertools import count, islice
def is_subseq(s, p):
while s and p:
if p%10 == s%10: s //= 10
p //= 10
return s == 0
def agen(): # generator of terms
an2, an1 = [1, 3]
yield from [an2, an1]
while True:
an = next(i*an1 for i in count(1) if is_subseq(an2, i*an1))
an2, an1 = an1, an
yield an
print(list(islice(agen(), 11))) # Michael S. Branicky, May 15 2024
(C) /* See links. */
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Bryle Morga, May 15 2024
EXTENSIONS
a(12)-a(13) from Michael S. Branicky, May 15 2024
a(14) from Kevin Ryde, Jun 23 2024
STATUS
approved