A037408 Positive numbers having the same set of digits in base 2 and base 3.
1, 9, 10, 12, 27, 28, 30, 36, 37, 39, 81, 82, 84, 85, 90, 91, 93, 94, 108, 109, 111, 112, 117, 118, 120, 243, 244, 246, 247, 252, 253, 256, 270, 271, 273, 274, 279, 280, 282, 283, 324, 325, 327, 328, 333, 334, 336, 337, 351, 352, 354, 355, 360, 361, 363
Offset: 1
Examples
9 is 1001 in binary and 100 in ternary. In both representations, the set of digits used is {0, 1}, hence 9 is in the sequence. 10 is 1010 in binary and 101 in ternary. In both representations, the set of digits used is {0, 1}, hence 10 is in the sequence. 11 is 1011 in binary and 102 in ternary. Clearly the binary representation can't include the digit 2, hence 11 is not in the sequence.
Links
- John Cerkan, Table of n, a(n) for n = 1..10000
Programs
-
Maple
filter:= proc(n) local F; F:= convert(convert(n,base,3),set); if has(F,2) then return false fi; evalb(F = convert(convert(n,base,2),set)) end proc: select(filter, [$1..1000]); # Robert Israel, Sep 18 2017
-
Mathematica
Select[Range[400], Union[IntegerDigits[#, 2]] == Union[IntegerDigits[#, 3]] &] (* Vincenzo Librandi Sep 09 2017 *)
-
PARI
isok(n) = vecsort(digits(n, 2),,8) == vecsort(digits(n, 3),,8); \\ Michel Marcus, Jan 05 2017
Extensions
Initial 0 added by Alonso del Arte, Sep 10 2017
Initial 0 removed by Georg Fischer, Oct 30 2020
Comments