A037384 Numbers k such that every base-3 digit of k is a base-8 digit of k.
1, 2, 13, 17, 26, 66, 80, 112, 120, 121, 122, 129, 136, 161, 168, 202, 242, 328, 394, 401, 458, 514, 522, 528, 529, 530, 531, 532, 533, 534, 535, 538, 546, 554, 562, 570, 578, 592, 610, 634, 640, 641, 642, 643, 644, 645, 646, 647
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Programs
-
Haskell
import Data.List ((\\), nub) a037384 n = a037384_list !! (n-1) a037384_list = filter f [1..] where f x = null $ nub (ds 3 x) \\ nub (ds 8 x) ds b x = if x > 0 then d : ds b x' else [] where (x', d) = divMod x b -- Reinhard Zumkeller, May 30 2013
-
Mathematica
b3b8Q[n_]:=Module[{b3=Union[IntegerDigits[n,3]],b8=Union[ IntegerDigits[n,8]]}, And@@Table[ MemberQ[b8,b3[[i]]],{i,Length[b3]}]]; Select[Range[700],b3b8Q] (* Harvey P. Dale, Apr 17 2013 *)
-
PARI
is(n)=#setminus(Set(digits(n,3)), Set(digits(n,8)))==0 \\ Charles R Greathouse IV, Feb 11 2017