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.

A037408 Positive numbers having the same set of digits in base 2 and base 3.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

From Alonso del Arte, Sep 10 2017: (Start)
Neither binary repunits (A000225 without the initial 0) nor ternary repunits (A003462 without the initial 0) can be in this sequence, except for 1.
The ternary repunits are numbers of the form (3^k - 1)/2. If k is odd, then (3^k - 1)/2 is even and therefore its binary representation ends in 0. If k is even, then (3^k - 1)/2 = 1 mod 4, which means its binary representation ends in 01.
For much more obvious reasons, numbers with even just one 2 in their ternary representations (A074940) can't be in this sequence. (End)

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.
		

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