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.

A302437 a(n) is the number of ways of writing the binary expansion of n as a concatenation of nonempty substrings with Hamming weight at most 2.

This page as a plain text file.
%I A302437 #14 Apr 15 2018 15:03:28
%S A302437 1,1,2,2,4,4,4,3,8,8,8,7,8,7,6,5,16,16,16,15,16,15,14,11,16,15,14,13,
%T A302437 12,11,10,8,32,32,32,31,32,31,30,23,32,31,30,27,28,25,22,18,32,31,30,
%U A302437 29,28,27,26,20,24,23,22,20,20,18,16,13,64,64,64,63,64
%N A302437 a(n) is the number of ways of writing the binary expansion of n as a concatenation of nonempty substrings with Hamming weight at most 2.
%C A302437 Leading zeros in the binary expansion of n are ignored.
%C A302437 The value a(0) = 1 corresponds to the empty concatenation.
%C A302437 See A301453 for similar sequences.
%H A302437 Rémy Sigrist, <a href="/A302437/b302437.txt">Table of n, a(n) for n = 0..10000</a>
%F A302437 a(2^n - 1) = A000045(n + 1) for any n >= 0.
%F A302437 a(2^n) = 2^n for any n >= 0.
%F A302437 a(2*n) = 2*a(n) for any n > 0.
%F A302437 If 1 <= A000120(n) <= 2 then a(n) = A053644(n).
%e A302437 For n = 14: the binary expansion of 14, "1110", can be split in 6 ways into substrings with Hamming weight at most 2:
%e A302437 - (11)(10),
%e A302437 - (11)(1)(0),
%e A302437 - (1)(110),
%e A302437 - (1)(11)(0),
%e A302437 - (1)(1)(10),
%e A302437 - (1)(1)(1)(0).
%e A302437 Hence a(14) = 6.
%o A302437 (PARI) a(n) = if (n==0, return (1), my (v=0, h=0); while (n, h += n%2; n\=2; if (h>2, break, v += a(n))); return (v))
%Y A302437 Cf. A000045, A000120, A053644, A301453.
%K A302437 nonn,base
%O A302437 0,3
%A A302437 _Rémy Sigrist_, Apr 08 2018