A004287 Least positive multiple of n written in base 7 using only 0 and 1.
1, 11, 111, 11, 101, 111111, 10, 11, 1011, 101, 10011, 111111, 1011, 110, 11001, 1111, 100111, 1101111, 111, 1111, 1110, 11101, 101011, 111111, 101, 111001, 1011, 110, 1111111, 1011111, 100111, 11011, 10011, 100111, 1010, 1101111
Offset: 1
Links
- Harvey P. Dale, Table of n, a(n) for n = 1..1000
Crossrefs
Cf. A244958 (written in base 10).
Programs
-
Mathematica
With[{cl=Rest[{FromDigits[#,7],FromDigits[#]}&/@Tuples[{0,1},7]]},Table[ SelectFirst[ cl,Mod[#[[1]],n]==0&],{n,40}]][[;;,2]] (* Harvey P. Dale, Jan 31 2024 *)
-
Python
def A004287(n): if n > 0: for i in range(1,2**n): s = bin(i)[2:] if not int(s,7) % n: return int(s) return 0 # Chai Wah Wu, Dec 30 2014
Extensions
Removed initial 0 since (1) it did not match the definition, and (2) there are many similar sequences with the same author which also say "positive". Also changed offset. - N. J. A. Sloane, Jan 31 2024
Previous b-file replaced by Harvey P. Dale, Jan 31 2024