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.

A385285 a(n) = Sum_{k=0..n} (binomial(n, k) mod 8).

This page as a plain text file.
%I A385285 #32 Jul 07 2025 11:56:36
%S A385285 1,2,4,8,16,16,32,32,16,32,24,48,40,64,40,64,16,32,40,64,48,48,88,96,
%T A385285 40,80,88,112,72,112,112,128,16,32,40,64,64,96,120,160,48,96,72,144,
%U A385285 104,176,160,192,40,80,104,176,120,176,176,224,72,144,160,224,176
%N A385285 a(n) = Sum_{k=0..n} (binomial(n, k) mod 8).
%C A385285 a(n) is a multiple of A001316(n). - _Chai Wah Wu_, Jun 26 2025
%H A385285 John Tyler Rascoe, <a href="/A385285/b385285.txt">Table of n, a(n) for n = 0..8192</a>
%H A385285 James G. Huard, Blair K. Spearman, and Kenneth S. Williams, <a href="https://doi.org/10.1006/eujc.1997.0146">Pascal's triangle (mod 8)</a>, European Journal of Combinatorics 19:1 (1998), pp. 45-62.
%H A385285 Chai Wah Wu, <a href="https://accidentaldesultorycogitations.blogspot.com/2025/07/sum-of-rows-of-pascals-triangle-modulo-8.html">Sum of rows of Pascal's triangle modulo 8</a>, blog post.
%p A385285 A385285 := n -> local k; add(modp(binomial(n, k), 8), k = 0..n): seq(A385285(n), n = 0..60);
%t A385285 A385285[n_] := Sum[Mod[Binomial[n, k], 8], {k, 0, n}];
%t A385285 Array[A385285, 100, 0] (* _Paolo Xausa_, Jun 26 2025 *)
%o A385285 (PARI) a(n) = sum(k=0, n, binomial(n, k) % 8); \\ _Michel Marcus_, Jun 26 2025
%o A385285 (Python)
%o A385285 def A385285(n):
%o A385285     if n==0: return 1
%o A385285     s = '0'+bin(n)[2:]
%o A385285     n1 = n>>1
%o A385285     n2 = n1>>1
%o A385285     n3 = n2>>1
%o A385285     np = ~n
%o A385285     n1111 = (n3&n2&n1&n).bit_count()
%o A385285     n11 = (n1&n).bit_count()
%o A385285     n101 = (n2&(~n1)&n).bit_count()
%o A385285     n100 = (n2&(~n1)&np).bit_count()
%o A385285     n110 = (n2&n1&np).bit_count()
%o A385285     n10 = (n1&np).bit_count()
%o A385285     n1100 = (n3&n2&(~n1)&np).bit_count()
%o A385285     m11 = s.count('0110')
%o A385285     m111 = s.endswith('0111')
%o A385285     c = (n100<<2)+n110+(n10*(n10-1)>>1)
%o A385285     if n11==0:
%o A385285         c += n10+(n100<<1)
%o A385285     elif n11==1:
%o A385285         c += (n10-n1100<<1)+n110
%o A385285     else:
%o A385285         c += n10<<1
%o A385285     if not (n1111 or n11 or n101):
%o A385285         c += 1
%o A385285     elif not (n1111 or n11) and n101:
%o A385285         c += 3
%o A385285     elif m111:
%o A385285         c += 4
%o A385285     elif not (n1111 or n101 or m11) and n11:
%o A385285         c += 2
%o A385285     else:
%o A385285         c += 4
%o A385285     return c<<n.bit_count() # _Chai Wah Wu_, Jun 26 2025
%Y A385285 Cf. A034930 (row sums of), A001316 (mod 2), A384715 (mod 4).
%K A385285 nonn,easy
%O A385285 0,2
%A A385285 _Peter Luschny_, Jun 26 2025