login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A004288 Least positive multiple of n written in base 8 using only 0 and 1. 2

%I #19 Jan 31 2024 16:28:54

%S 1,10,11,10,101,110,1111111,10,11,1010,10111,110,101,11111110,1111,

%T 100,10001,110,1001,1010,101011111,101110,101001,110,1011111,1010,

%U 1001,11111110,1010011,11110,11111,100,100001,100010,100111111,110

%N Least positive multiple of n written in base 8 using only 0 and 1.

%H Chai Wah Wu, <a href="/A004288/b004288.txt">Table of n, a(n) for n = 0..10000</a>

%p f:= proc(n) local R, S, m, p, Snew, s;

%p R[1]:= 1; R[0]:= 0; S:= {0,1};

%p for m from 1 do

%p p:= 8^m mod n;

%p Snew:= map(s -> s + p mod n, S);

%p if member(0,Snew) then return R[-p mod n]+10^m fi;

%p for s in Snew minus S do R[s] := R[s - p mod n] + 10^m od;

%p S:= S union Snew;

%p od

%p end proc:

%p 1, seq(f(n), n=2..100); # _Robert Israel_, Dec 30 2014

%o (Python)

%o def A004288(n):

%o if n > 0:

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

%o s = bin(i)[2:]

%o if not int(s,8) % n:

%o return int(s)

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

%K nonn,base

%O 1,2

%A _David W. Wilson_

%E a(11), a(22), a(25) corrected by _Chai Wah Wu_, Dec 30 2014

%E Initial 0 deleted and offset corrected by _N. J. A. Sloane_, Jan 31 2024

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)