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.

A180938 Smallest k such that k*n has an even number of 1's in its base-2 expansion.

This page as a plain text file.
%I A180938 #38 Feb 22 2022 17:13:38
%S A180938 3,3,1,3,1,1,9,3,1,1,3,1,3,9,1,3,1,1,3,1,3,3,1,1,3,3,1,9,1,1,33,3,1,1,
%T A180938 3,1,3,3,1,1,3,3,1,3,1,1,3,1,3,3,1,3,1,1,3,9,1,1,3,1,3,33,1,3,1,1,3,1,
%U A180938 3,3,1,1,3,3,1,3,1,1,3,1,3,3,1,3,1,1,5,3,1,1,5,1,11,3,1,1,3,3,1,3,1,1,9,3,1
%N A180938 Smallest k such that k*n has an even number of 1's in its base-2 expansion.
%C A180938 From _Robert G. Wilson v_, Sep 29 2010: (Start)
%C A180938 k must always be odd.
%C A180938 First occurrence of odd k: 3, 1, 87, 109, 7, 93, 457, 1143, 5501, 7921, 889, 12775, 11753, 635, 111209, 6093, 31, 33823, 7665, ..., .
%C A180938 (End)
%H A180938 Antti Karttunen, <a href="/A180938/b180938.txt">Table of n, a(n) for n = 1..32768</a>
%e A180938 For n = 7, a(n) = 9, since the smallest multiple of 7 with an even number of 1's in its base-2 expansion is 9*7 = 63.
%t A180938 a[n_] := Block[{k = 1}, While[OddQ@ DigitCount[k*n, 2, 1], k++ ]; k]; Array[a, 100] (* _Robert G. Wilson v_, Sep 29 2010 *)
%o A180938 (PARI) A180938(n) = my(k=1); while(hammingweight(k*n)%2, k += 2); k; \\ _Antti Karttunen_, Jul 09 2017
%o A180938 (Python)
%o A180938 def a(n):
%o A180938     k=1
%o A180938     while True:
%o A180938         if not bin(k*n)[2:].count('1')%2: return k
%o A180938         k+=1
%o A180938 print([a(n) for n in range(1, 61)]) # _Indranil Ghosh_, Jul 11 2017
%Y A180938 Cf. A001969, A178757.
%Y A180938 Cf. A083420 (where records occur). - _Alois P. Heinz_, Oct 16 2011
%K A180938 nonn,base
%O A180938 1,1
%A A180938 _Jeffrey Shallit_, Sep 26 2010
%E A180938 More terms from _Robert G. Wilson v_, Sep 29 2010