cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A178158 Numbers n that are divisible by every suffix of n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 21, 22, 24, 25, 31, 32, 33, 35, 36, 41, 42, 44, 45, 48, 51, 52, 55, 61, 62, 63, 64, 65, 66, 71, 72, 75, 77, 81, 82, 84, 85, 88, 91, 92, 93, 95, 96, 99, 101, 102, 104, 105, 125, 201, 202, 204, 205, 208, 225, 301, 302, 303, 304, 305, 306, 312, 315, 325, 375, 401, 402, 404, 405, 408, 425, 501, 502, 504, 505, 525, 601, 602, 603, 604
Offset: 1

Views

Author

Michel Lagneau, Dec 17 2010

Keywords

Comments

If n = y*10^d+z is in the sequence, where 1<=y<=9 and z < 10^d, then z | y*10^d. - Robert Israel, Oct 17 2018

Examples

			9375 is in the sequence because :
.     5 | 9375 ;
.    75 | 9375 ;
.   375 | 9375 ;
.  9375 | 9375 .
		

Crossrefs

Cf. A034709 .
Cf. A067251.

Programs

  • Haskell
    import Data.List (tails)
    a178158 n = a178158_list !! (n-1)
    a178158_list = filter (\suff -> all ((== 0) . (mod suff))
       (map read $ tail $ init $ tails $ show suff :: [Integer])) a067251_list
    -- Reinhard Zumkeller, Mar 26 2012
  • Maple
    with(numtheory):T:=array(1..5):for n from 1 to 10000 do:ind:=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 : s:=s + u*10 ^m:if irem(n,10)<>0 and irem(n, s)=0 then ind:=ind+1:else fi:od:if ind=l then printf(`%d,`, n):else fi:od:
    # Alternative:
    filter:= proc(x)
      if x mod 10 = 0 then return false fi;
      andmap(t -> type(x/(x mod 10^t),integer), [$1..ilog10(x)])
    end proc:
    Res:= $1..9:
    for d from 1 to 6 do
      for y from 1 to 9 do
        for z in sort(convert(select(`<`,numtheory:-divisors(y*10^d),10^d),list)) do
          if filter(y*10^d+z) then
             Res:= Res, y*10^d+z;
          fi
    od od od:
    Res; # Robert Israel, Oct 17 2018