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.

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

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