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
KEYWORD
nonn,base
AUTHOR
Michel Lagneau, Dec 15 2010
STATUS
approved