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.

A000989 3-adic valuation of binomial(2*n, n): largest k such that 3^k divides binomial(2*n, n).

Original entry on oeis.org

0, 0, 1, 0, 0, 2, 1, 1, 2, 0, 0, 1, 0, 0, 3, 2, 2, 3, 1, 1, 2, 1, 1, 3, 2, 2, 3, 0, 0, 1, 0, 0, 2, 1, 1, 2, 0, 0, 1, 0, 0, 4, 3, 3, 4, 2, 2, 3, 2, 2, 4, 3, 3, 4, 1, 1, 2, 1, 1, 3, 2, 2, 3, 1, 1, 2, 1, 1, 4, 3, 3, 4, 2, 2, 3, 2, 2, 4, 3, 3
Offset: 0

Views

Author

Keywords

Comments

a(n) = 0 if and only if n is in A005836. - Charles R Greathouse IV, May 19 2013
sign(a(n+1) - a(n)) is repeat [0, 1, -1]. - Filip Zaludek, Oct 29 2016
By Kummer's theorem, number of carries when adding n + n in base 3. - Robert Israel, Oct 30 2016

Crossrefs

Programs

  • Haskell
    a000989 = a007949 . a000984  -- Reinhard Zumkeller, Nov 19 2015
  • Maple
    f:= proc(n) option remember; local k,m,d;
       k:= floor(log[3](n));
       d:= floor(n/3^k);
       m:= n-d*3^k;
       if d = 2 or 2*m > 3^k then procname(m)+1
       else procname(m)
       fi
    end proc:
    f(0):= 0:
    map(f, [$0..100]); # Robert Israel, Oct 30 2016
  • Mathematica
    p=3; Array[ If[ Mod[ bi=Binomial[ 2#, # ], p ]==0, Select[ FactorInteger[ bi ], Function[ q, q[ [ 1 ] ]==p ], 1 ][ [ 1, 2 ] ], 0 ]&, 27*3, 0 ]
    Table[ IntegerExponent[ Binomial[2 n, n], 3], {n, 0, 100}] (* Jean-François Alcover, Feb 15 2016 *)
  • PARI
    a(n) = valuation(binomial(2*n, n), 3)
    
  • PARI
    a(n)=my(N=2*n,s);while(N\=3,s+=N);while(n\=3,s-=2*n);s \\ Charles R Greathouse IV, May 19 2013
    

Formula

a(n) = Sum_{k>=0} floor(2*n/3^k) - 2*Sum_{k>=0} floor(n/3^k). - Benoit Cloitre, Aug 26 2003
a(n) = A007949(A000984(n)). - Reinhard Zumkeller, Nov 19 2015
From Robert Israel, Oct 30 2016: (Start)
If 2*n < 3^k then a(3^k+n) = a(n).
If n < 3^k < 2*n then a(3^k+n) = a(n)+1.
If n < 3^k then a(2*3^k+n) = a(n)+1. (End)
a(n) = A053735(n) - A053735(2*n)/2. - Amiram Eldar, Feb 12 2021
From Miles Wilson, Jul 06 2025: (Start)
a(n) = A007949(n+1) + A067397(n).
G.f.: Sum_{k>=1} (x^(3^k/2+1/2)-x^(3^k))/((x-1)*(x^(3^k)-1)). (End)