login
Smallest positive multiple of n whose base 8 representation contains only 0's and 1's.
2

%I #19 Feb 03 2024 13:25:30

%S 1,8,9,8,65,72,299593,8,9,520,4169,72,65,2396744,585,64,4097,72,513,

%T 520,17044041,33352,33281,72,266825,520,513,2396744,266249,4680,4681,

%U 64,32769,32776,16814665,72,262145,4104,585,520,32841,136352328,36937,33352,585

%N Smallest positive multiple of n whose base 8 representation contains only 0's and 1's.

%H Harvey P. Dale, <a href="/A244959/b244959.txt">Table of n, a(n) for n = 1..1000</a>

%H Ed Pegg Jr., <a href="http://www.mathpuzzle.com/Binary.html">'Binary' Puzzle</a>

%H Eric M. Schmidt, <a href="/A004290/a004290_1.sage.txt">Sage code to compute this sequence</a> (use b=8)

%H Chai Wah Wu, <a href="http://www.jstor.org/stable/10.4169/amer.math.monthly.121.06.529">Pigeonholes and repunits</a>, Amer. Math. Monthly, 121 (2014), 529-533.

%t Module[{nn=10,b8},b8=Rest[FromDigits[#,8]&/@Tuples[{0,1},nn]];Table[SelectFirst[ b8,Mod[#,n]==0&],{n,100}]] (* _Harvey P. Dale_, Feb 03 2024 *)

%o (Python)

%o def A244959(n):

%o ....if n > 0:

%o ........for i in range(1,2**n):

%o ............x = int(bin(i)[2:],8)

%o ............if not x % n:

%o ................return x

%o ....return 0 # _Chai Wah Wu_, Dec 30 2014

%Y Cf. A004288 (written in base 8), A004290, A244954-A244960.

%K nonn,base

%O 1,2

%A _Eric M. Schmidt_, Jul 09 2014

%E Data corrected, offset corrected, and b-file replaced by _Harvey P. Dale_, Feb 03 2024