A386952 Number of entries in the n-th row of Pascal's triangle not divisible by 9.
1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 8, 12, 9, 12, 15, 14, 16, 18, 7, 14, 21, 14, 19, 24, 21, 24, 27, 4, 8, 12, 12, 18, 24, 20, 28, 36, 9, 18, 27, 20, 28, 36, 31, 38, 45, 14, 28, 42, 28, 38, 48, 42, 48, 54, 7, 14, 21, 20, 31, 42, 33, 48, 63, 14, 28, 42, 31, 44, 57, 48
Offset: 0
Keywords
Links
- James G. Huard, Blair K. Spearman, and Kenneth S. Williams, Pascal's triangle (mod 9), Acta Arithmetica, 78 (1997), 331-349.
Programs
-
Python
import re from gmpy2 import digits def A386952(n): s = digits(n,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') return ((3*((1+n01<<2)+n11)+((n02<<2)+n12<<2))*3**n2<
>2