login
A037406
Numbers k such that every base-8 digit of k is a base-10 digit of k.
3
1, 2, 3, 4, 5, 6, 7, 45, 105, 127, 235, 274, 365, 436, 487, 614, 713, 731, 1017, 1024, 1025, 1026, 1032, 1042, 1124, 1162, 1206, 1233, 1234, 1235, 1243, 1273, 1426, 1462, 1603, 1630, 1653, 1723, 1737, 1739, 1743, 1753, 2048
OFFSET
1,2
LINKS
MATHEMATICA
b8dQ[n_]:=Module[{idn=Union[IntegerDigits[n]], idn8=Union[IntegerDigits[n, 8]]}, And@@Table[MemberQ[idn, idn8[[i]]], {i, Length[idn8]}]]
Select[Range[2100], b8dQ] (* Harvey P. Dale, Feb 27 2011 *)
PROG
(Haskell)
import Data.List ((\\), nub)
a037406 n = a037406_list !! (n-1)
a037406_list = filter f [1..] where
f x = null $ nub (ds 8 x) \\ nub (ds 10 x)
ds b x = if x > 0 then d : ds b x' else [] where (x', d) = divMod x b
-- Reinhard Zumkeller, May 30 2013
(Python)
def ok(n): return set(oct(n)[2:]) <= set(str(n))
print(list(filter(ok, range(1, 2049)))) # Michael S. Branicky, Aug 22 2021
CROSSREFS
Sequence in context: A024646 A327733 A084831 * A237344 A024647 A250263
KEYWORD
nonn,base
STATUS
approved