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.

A140977 a(n) is the smallest integer > n that has the same number of (nonleading) zeros in its binary representation as n has.

This page as a plain text file.
%I A140977 #23 Feb 06 2020 14:50:52
%S A140977 3,5,7,9,6,11,15,17,10,12,13,19,14,23,31,33,18,20,21,24,22,25,27,35,
%T A140977 26,28,29,39,30,47,63,65,34,36,37,40,38,41,43,48,42,44,45,49,46,51,55,
%U A140977 67,50,52,53,56,54,57,59,71,58,60,61,79,62,95,127,129,66,68,69,72,70,73,75
%N A140977 a(n) is the smallest integer > n that has the same number of (nonleading) zeros in its binary representation as n has.
%C A140977 Permutation of the non-binary powers, cf. A057716. - _Reinhard Zumkeller_, Aug 15 2010
%H A140977 R. Zumkeller, <a href="/A140977/b140977.txt">Table of n, a(n) for n = 1..1000</a>
%H A140977 Rémy Sigrist, <a href="/A140977/a140977.gp.txt">PARI program for A140977</a>
%e A140977 4 in binary is 100, which has 2 zeros. Checking the binary representations of the integers > 4: 5 = 101 in binary, which has one 0. 6 = 110 in binary, which has one 0. 7 = 111 in binary, which has zero 0's. 8 = 1000 in binary, which has three 0's. But 9 = 1001 in binary, which has two 0's, the same number of zeros that 4 (= 100 in binary) has. So a(4) = 9.
%t A140977 a = {}; For[n = 1, n < 100, n++, i = n + 1; While[ ! DigitCount[i, 2, 0] == DigitCount[n, 2, 0], i++ ]; AppendTo[a, i]]; a (* _Stefan Steinerberger_, Aug 25 2008 *)
%t A140977 snz[n_]:=Module[{dn=DigitCount[n,2,0],k=n+1},While[DigitCount[k,2,0] != dn, k++]; k]; Array[snz, 100] (* _Harvey P. Dale_, May 15 2015 *)
%o A140977 (PARI) See Links section.
%Y A140977 Cf. A057168, A023416.
%K A140977 base,nonn
%O A140977 1,1
%A A140977 _Leroy Quet_, Aug 17 2008
%E A140977 More terms from _Stefan Steinerberger_, Aug 25 2008