login
A177902
Numbers k such that d(i)|(k - i) for i = 1..p where d(1), d(2), ..., d(p) are the digits of the decimal expansion of k.
1
1, 11, 12, 14, 18, 21, 23, 29, 31, 34, 37, 41, 51, 56, 61, 71, 81, 91, 111, 131, 157, 191, 211, 213, 219, 437, 511, 857, 1111, 1112, 1117, 1121, 1123, 1129, 1131, 1153, 1161, 1172, 1187, 1191, 1212, 1216, 1512, 1731, 2111, 2113, 2119, 2121, 2143, 2173, 2321, 2517, 2587, 2711, 3112, 3121, 3712, 4121, 4153, 4161, 4197, 5111, 5116, 5121, 5176, 5321, 5721, 6121, 7512, 8113, 8121, 8321, 8921
OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..500 from Harvey P. Dale)
EXAMPLE
925678 is in the sequence because
9 | 925677,
2 | 925676,
5 | 925675,
6 | 925674,
7 | 925673,
8 | 925672.
MAPLE
with(numtheory):for n from 1 to 10000 do:i:=0:l:=length(n):n0:=n:s:=0:for m
from 0 to l-1 do:q:=n0:u:=irem(q, 10):v:=iquo(q, 10):n0:=v :w:=n-l+m:if u<>0 and
irem(w, u)=0 then i:=i+1:else fi:od:if i=l then printf(`%d, `, n):else fi:od:
MATHEMATICA
okQ[n_]:=Module[{idn=IntegerDigits[n]}, !MemberQ[idn, 0]&&And@@Divisible[ Table[n-i, {i, Length[idn]}], Table[idn[[j]], {j, Length[idn]}]]]; Select[ Range[ 9000], okQ] (* Harvey P. Dale, Sep 25 2011 *)
PROG
(Sage) is_A177902 = lambda n: all(d.divides(n-i) for i, d in enumerate(n.digits()[::-1], 1)) # D. S. McNeil, Dec 16 2010
(Python)
def ok(n): return all(di!=0 and (n-i)%di==0 for i, di in enumerate(map(int, str(n)), 1))
print([k for k in range(9000) if ok(k)]) # Michael S. Branicky, Feb 20 2023
(Python) # faster version for b-file/initial segment of sequence
from itertools import count, islice, product
def agen():
for digits in count(1):
for d in product("123456789", repeat=digits):
k = int("".join(d))
if all((k-i)%di==0 for i, di in enumerate(map(int, d), 1)):
yield k
print(list(islice(agen(), 50))) # Michael S. Branicky, Feb 20 2023
CROSSREFS
Sequence in context: A182404 A234021 A264023 * A108722 A246139 A034907
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Dec 15 2010
STATUS
approved