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.

A034930 Triangle, read by rows, formed by reading Pascal's triangle (A007318) mod 8.

This page as a plain text file.
%I A034930 #35 Jul 23 2025 00:57:45
%S A034930 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,2,2,5,1,1,6,7,4,7,6,1,1,7,5,3,3,5,
%T A034930 7,1,1,0,4,0,6,0,4,0,1,1,1,4,4,6,6,4,4,1,1,1,2,5,0,2,4,2,0,5,2,1,1,3,
%U A034930 7,5,2,6,6,2,5,7,3,1,1,4,2,4,7,0,4,0,7,4,2,4,1,1,5,6,6,3,7,4,4,7,3,6,6,5,1
%N A034930 Triangle, read by rows, formed by reading Pascal's triangle (A007318) mod 8.
%H A034930 Reinhard Zumkeller, <a href="/A034930/b034930.txt">Rows n = 0..120 of triangle, flattened</a>
%H A034930 Ilya Gutkovskiy, <a href="/A275198/a275198.pdf">Illustrations (triangle formed by reading Pascal's triangle mod m)</a>
%H A034930 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 A034930 <a href="/index/Pas#Pascal">Index entries for triangles and arrays related to Pascal's triangle</a>
%F A034930 T(n+1,k) = (T(n,k) + T(n,k-1)) mod 8. - _Reinhard Zumkeller_, Jul 12 2013
%t A034930 Mod[ Flatten[ Table[ Binomial[n, k], {n, 0, 13}, {k, 0, n}]], 8] (* _Robert G. Wilson v_, May 26 2004 *)
%o A034930 (Haskell)
%o A034930 a034930 n k = a034930_tabl !! n !! k
%o A034930 a034930_row n = a034930_tabl !! n
%o A034930 a034930_tabl = iterate
%o A034930    (\ws -> zipWith (\u v -> mod (u + v) 8) ([0] ++ ws) (ws ++ [0])) [1]
%o A034930 -- _Reinhard Zumkeller_, Jul 12 2013, Jun 21 2013
%o A034930 (Python)
%o A034930 from math import comb, isqrt
%o A034930 def A034930(n):
%o A034930     g = (m:=isqrt(f:=n+1<<1))-(f<=m*(m+1))
%o A034930     k = n-comb(g+1,2)
%o A034930     if k.bit_count()+(g-k).bit_count()-g.bit_count()>2: return 0
%o A034930     def g1(s,w,e):
%o A034930         c, d = 1, 0
%o A034930         if len(s) == 0: return c, d
%o A034930         a, b = int(s,2), int(w,2)
%o A034930         if a>=b:
%o A034930             k = comb(a,b)&7
%o A034930             j = (~k & k-1).bit_length()
%o A034930             d += j*e
%o A034930             k >>= j
%o A034930             c = c*pow(k,e,8)&7
%o A034930         else:
%o A034930             if int(s[0:1],2)<int(w[0:1],2): d += e
%o A034930             c0, d0 = g1(s[1:],w[1:],e)
%o A034930             c = c*c0&7
%o A034930             d += d0
%o A034930         return c, d
%o A034930     s = bin(g)[2:].zfill(3)
%o A034930     w = bin(k)[2:].zfill(l:=len(s))
%o A034930     c, d = g1(s[:3],w[:3],1)
%o A034930     for i in range(1,l-1):
%o A034930         c0, d0 = g1(s[i:i+3],w[i:i+3],1)
%o A034930         c1, d1 = g1(s[i:i+2],w[i:i+2],-1)
%o A034930         c = c*c0*c1&7
%o A034930         d += d0+d1
%o A034930     return (c<<d)&7 # _Chai Wah Wu_, Jul 20 2025
%Y A034930 Cf. A007318, A047999, A083093, A034931, A008975, A034932.
%Y A034930 Sequences based on the triangles formed by reading Pascal's triangle mod m: A047999 (m = 2), A083093 (m = 3), A034931 (m = 4), A095140 (m = 5), A095141 (m = 6), A095142 (m = 7), (this sequence) (m = 8), A095143 (m = 9), A008975 (m = 10), A095144 (m = 11), A095145 (m = 12), A275198 (m = 14), A034932 (m = 16).
%K A034930 nonn,tabl
%O A034930 0,5
%A A034930 _N. J. A. Sloane_