OFFSET
0,6
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
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..2000
Michael Gilleland, Some Self-Similar Integer Sequences.
E. E. Kummer, Über die Ergänzungssätze zu den allgemeinen Reciprocitätsgesetzen, Journal für die reine und angewandte Mathematik, Vol. 44 (1852), pp. 93-146; alternative link.
Dorel Miheţ, Legendre's and Kummer's theorems again, Resonance, Vol. 15, No. 12 (2010), pp. 1111-1121; alternative link.
Armin Straub, Victor H. Moll and Tewodros Amdeberhan, The p-adic valuation of k-central binomial coefficients, Acta Arithmetica, Vol. 140, No. 1 (2009), pp. 31-42.
Wikipedia, Kummer's theorem.
FORMULA
a(n) = Sum_{k>=0} floor(2*n/3^k) - 2*Sum_{k>=0} floor(n/3^k). - Benoit Cloitre, Aug 26 2003
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)
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 *)
PROG
(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
(Haskell)
a000989 = a007949 . a000984 -- Reinhard Zumkeller, Nov 19 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved