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.

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

This page as a plain text file.
%I A095143 #31 Jul 23 2025 00:57:11
%S A095143 1,1,1,1,2,1,1,3,3,1,1,4,6,4,1,1,5,1,1,5,1,1,6,6,2,6,6,1,1,7,3,8,8,3,
%T A095143 7,1,1,8,1,2,7,2,1,8,1,1,0,0,3,0,0,3,0,0,1,1,1,0,3,3,0,3,3,0,1,1,1,2,
%U A095143 1,3,6,3,3,6,3,1,2,1,1,3,3,4,0,0,6,0,0,4,3,3,1,1,4,6,7,4,0,6,6,0,4,7,6,4,1
%N A095143 Triangle, read by rows, formed by reading Pascal's triangle (A007318) mod 9.
%H A095143 Ilya Gutkovskiy, <a href="/A275198/a275198.pdf">Illustrations (triangle formed by reading Pascal's triangle mod m)</a>
%H A095143 James G. Huard, Blair K. Spearman and Kenneth S. Williams, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa78/aa7843.pdf">Pascal's triangle (mod 9)</a>, Acta Arithmetica (1997), Volume: 78, Issue: 4, page 331-349.
%H A095143 <a href="/index/Pas#Pascal">Index entries for triangles and arrays related to Pascal's triangle</a>
%F A095143 T(i, j) = binomial(i, j) mod 9.
%e A095143 Triangle begins:
%e A095143               1;
%e A095143             1,  1;
%e A095143           1,  2,  1;
%e A095143         1,  3,  3,  1;
%e A095143       1,  4,  6,  4,  1;
%e A095143     1,  5,  1,  1,  5,  1;
%e A095143   1,  6,  6,  2,  6,  6,  1;
%e A095143   ...
%t A095143 Mod[ Flatten[ Table[ Binomial[n, k], {n, 0, 13}, {k, 0, n}]], 9]
%o A095143 (Python)
%o A095143 from math import isqrt, comb
%o A095143 from gmpy2 import digits
%o A095143 def A095143(n):
%o A095143     g = (m:=isqrt(f:=n+1<<1))-(f<=m*(m+1))
%o A095143     k = n-comb(g+1,2)
%o A095143     if sum(int(d) for d in digits(k,3))+sum(int(d) for d in digits(g-k,3))-sum(int(d) for d in digits(g,3))>2: return 0
%o A095143     s, c, d = digits(g,3), 1, 0
%o A095143     w = (digits(k,3)).zfill(l:=len(s))
%o A095143     if l == 1: return comb(g,k)%9
%o A095143     for i in range(0,l-1):
%o A095143         r, t = s[i:i+2], w[i:i+2]
%o A095143         if (x:=int(r,3)) < (y:=int(t,3)):
%o A095143             d += (t[0]>r[0])+(t[1]>r[1])
%o A095143             if r[1]>=t[1]:
%o A095143                 c = c*comb(int(r[1],3),int(t[1],3))%9
%o A095143         else:
%o A095143             c = c*comb(x,y)%9
%o A095143     for i in range(1,l-1):
%o A095143         if w[i]>s[i] or (z:=comb(int(s[i],3),int(w[i],3))) == 3:
%o A095143             d -= 1
%o A095143         else:
%o A095143             c = c*pow(z,-1,9)%9
%o A095143     return c*3**d%9 # _Chai Wah Wu_, Jul 19 2025
%Y A095143 Cf. A007318, A047999, A083093, A034931, A095140, A095141, A095142, A034930, A008975, A095144, A095145, A034932.
%Y A095143 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), (this sequence) (m = 9), A008975 (m = 10), A095144 (m = 11), A095145 (m = 12), A275198 (m = 14), A034932 (m = 16).
%K A095143 easy,nonn,tabl
%O A095143 0,5
%A A095143 _Robert G. Wilson v_, May 29 2004