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.

Showing 1-2 of 2 results.

A227428 Number of twos in row n of triangle A083093.

Original entry on oeis.org

0, 0, 1, 0, 0, 2, 1, 2, 4, 0, 0, 2, 0, 0, 4, 2, 4, 8, 1, 2, 4, 2, 4, 8, 4, 8, 13, 0, 0, 2, 0, 0, 4, 2, 4, 8, 0, 0, 4, 0, 0, 8, 4, 8, 16, 2, 4, 8, 4, 8, 16, 8, 16, 26, 1, 2, 4, 2, 4, 8, 4, 8, 13, 2, 4, 8, 4, 8, 16, 8, 16, 26, 4, 8, 13, 8, 16, 26, 13, 26, 40
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 11 2013

Keywords

Comments

"The number of entries with value r in the n-th row of Pascal's triangle modulo k is found to be 2^{#r^k (n)}, where now #_r^k (n) gives the number of occurrences of the digit r in the base-k representation of the integer n." [Wolfram] - _R. J. Mathar, Jul 26 2017 [This is not correct: there are entries in the sequence that are not powers of 2. - Antti Karttunen, Jul 26 2017]

Examples

			Example of Wilson's formula: a(26) = 13 = 2^(0-1)*(3^3-1) = 26/2, where A062756(26)=0, A081603(26)=3, 26=(222)_3. - _R. J. Mathar_, Jul 26 2017
		

Crossrefs

Programs

  • Haskell
    a227428 = sum . map (flip div 2) . a083093_row
    
  • Maple
    A227428 := proc(n)
        local a;
        a := 0 ;
        for k from 0 to n do
            if A083093(n,k) = 2 then
                a := a+1 ;
            end if;
        end do:
        a ;
    end proc:
    seq(A227428(n),n=0..20) ; # R. J. Mathar, Jul 26 2017
  • Mathematica
    Table[Count[Mod[Binomial[n, Range[0, n]], 3], 2], {n, 0, 99}] (* Alonso del Arte, Feb 07 2012 *)
  • PARI
    A227428(n) = sum(k=0,n,2==(binomial(n,k)%3)); \\ (Naive implementation, from the description) Antti Karttunen, Jul 26 2017
    
  • Python
    from sympy import binomial
    def a(n):
        return sum(1 for k in range(n + 1) if binomial(n, k) % 3 == 2)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jul 26 2017
    
  • Python
    from sympy.ntheory import digits
    def A227428(n):
        s = digits(n,3)[1:]
        return 3**s.count(2)-1<>1 # Chai Wah Wu, Jul 24 2025
    
  • Scheme
    (define (A227428 n) (* (A000079 (- (A062756 n) 1)) (+ -1 (A000244 (A081603 n))))) ;; After Wilson's direct formula, Antti Karttunen, Jul 26 2017

Formula

a(n) = A006047(n) - A206424(n) = n + 1 - A062296(n) - A206424(n).
a(n) = 2^(N_1-1)*(3^N_2-1) where N_1 = A062756(n), N_2 = A081603(n). [Wilson, Theorem 2, Wells] - R. J. Mathar, Jul 26 2017
a(n) = A206424(n) * ((3^A081603(n))-1) / ((3^A081603(n))+1). - Antti Karttunen, Jul 27 2017
a(n) = (1/2)*Sum_{k = 0..n} mod(C(n,k)^2 - C(n,k), 3). - Peter Bala, Dec 17 2020

A206427 Square array 2^(m-1)*(3^n+1), read by antidiagonals.

Original entry on oeis.org

1, 2, 2, 5, 4, 4, 14, 10, 8, 8, 41, 28, 20, 16, 16, 122, 82, 56, 40, 32, 32, 365, 244, 164, 112, 80, 64, 64, 1094, 730, 488, 328, 224, 160, 128, 128, 3281, 2188, 1460, 976, 656, 448, 320, 256, 256, 9842, 6562, 4376, 2920, 1952, 1312, 896, 640, 512, 512
Offset: 0

Views

Author

Marcus Jaiclin, Feb 07 2012

Keywords

Comments

Rectangular array giving the number of 1's in any row of Pascal's Triangle (mod 3) whose row number has exactly m 1's and n 2's in its ternary expansion (listed by antidiagonals).
a(m,n) is independent of the number of zeros in the ternary expansion of the row number.
a(m,n) gives a non-recursive formula for A206424.

Examples

			Initial 5 X 5 block of entries (upper corner is (m,n)=(0,0), m increases down, n increases across):
1    2    5   14   41
2    4   10   28   82
4    8   20   56  164
8   16   40  112  328
16  32   80  224  656
Pascal's Triangle (mod 3), row numbers in ternary:
1     <=  Row 0, m = 0, n = 0, 2^(-1)(3^0 + 1) = #1's = 1
1 1     <=  Row 1, m = 1, n = 0, 2^0(3^0 + 1) = #1's = 2
1 2 1     <=  Row 2, m = 0, n = 1, 2^(-1)(3^1 + 1) = #1's = 2
1 0 0 1     <=  Row 10, m = 1, n = 0, 2^0(3^0 + 1) = #1's = 2
1 1 0 1 1     <=  Row 11, m = 2, n = 0, 2^1(3^0 + 1) = #1's = 4
1 2 1 1 2 1     <=  Row 12, m = 1, n = 1, 2^0(3^1 + 1) = #1's = 4
1 0 0 2 0 0 1     <=  Row 20, m = 0, n = 1, 2^(-1)(3^1 + 1) = #1's = 2
1 1 0 2 2 0 1 1     <=  Row 21, m = 1, n = 1, 2^0(3^1 + 1) = #1's = 4
1 2 1 2 1 2 1 2 1     <=  Row 22, m = 0, n = 2, 2^(-1)(3^2 + 1) = #1's = 5
1 0 0 0 0 0 0 0 0 1     <=  Row 100, m = 1, n = 0, 2^0(3^0 + 1) = #1's = 2
		

Crossrefs

Formula

a(m, n) = 2^(m - 1)(3^n + 1).
Showing 1-2 of 2 results.