login
A386953
Total number of entries in rows 0,1,...,n of Pascal's triangle not divisible by 9.
2
1, 3, 6, 10, 15, 21, 28, 36, 45, 49, 57, 69, 78, 90, 105, 119, 135, 153, 160, 174, 195, 209, 228, 252, 273, 297, 324, 328, 336, 348, 360, 378, 402, 422, 450, 486, 495, 513, 540, 560, 588, 624, 655, 693, 738, 752, 780, 822, 850, 888, 936, 978, 1026, 1080, 1087
OFFSET
0,2
LINKS
James G. Huard, Blair K. Spearman, and Kenneth S. Williams, Pascal's triangle (mod 9), Acta Arithmetica, 78 (1997), 331-349.
MAPLE
P:= [1]; R:= 1:
for i from 1 to 100 do
P:= [1, op(P[2..-1]+P[1..-2] mod 9), 1];
v:=i+1 - numboccur(0, P):
R:= R, v;
od:
ListTools:-PartialSums([R]); # Robert Israel, Sep 10 2025
PROG
(Python)
import re
from gmpy2 import digits
def A386953(n):
c = 0
for m in range(n+1):
s = digits(m, 3)
n1 = s.count('1')
n2 = s.count('2')
n01 = s.count('10')
n02 = s.count('20')
n11 = len(re.findall('(?=11)', s))
n12 = s.count('21')
c += ((3*((1+n01<<2)+n11)+((n02<<2)+n12<<2))*3**n2<<n1)//3>>2
return c
CROSSREFS
KEYWORD
nonn
AUTHOR
Chai Wah Wu, Aug 10 2025
STATUS
approved