OFFSET
1,6
LINKS
Kenny Lau, Table of n, a(n) for n = 1..9999
Clemens Heuberger and Helmut Prodinger, A precise description of the p-adic valuation of the number of alternating sign matrices, Intl. J. Numb. Th., Vol. 7, No. 1 (2011), pp. 57-69.
FORMULA
a(n) = a(n-1) + s(2*n-2) + s(2*n-1) - s(n-1) - s(3*n-2), where s(n) = A000120(n). - Amiram Eldar, Feb 21 2021
MAPLE
Sp := proc(n, p) add(d, d=convert(n, base, p)) ; end proc:
nuA005130 := proc(n, p) add(Sp(n+j, p), j=0..n-1)-add(Sp(3*j+1, p), j=0..n-1) ; %/(p-1) ; end proc:
A194827 := proc(n) nuA005130(n, 2) ; end proc:
MATHEMATICA
s[n_] := DigitCount[n, 2, 1]; a[0] = 0; a[n_] := a[n] = a[n - 1] + s[2*n - 2] + s[2*n - 1] - s[n - 1] - s[3*n - 2]; Array[a, 100] (* Amiram Eldar, Feb 21 2021 *)
PROG
(Python)
# a(n) = prod(k=0, n-1, (3k+1)!/(n+k)!)
# a(n+1) = prod(k=0, n, (3k+1)!/(n+k+1)!)
# a(n+1) = prod(k=0, n, (3k+1)!/(n+k)!) prod(k=0, n, 1/(n+k+1))
# a(n+1)/a(n) = [(3n+1)!/(2n)!] [n!/(2n+1)!]
n=10000; N=3*n+1; val=[0]*(N+1); exp=2
while exp <= N:
....for j in range(exp, N+1, exp): val[j] += 1
....exp *= 2
fac_val=[0]*(N+1)
for i in range(N): fac_val[i+1] = fac_val[i] + val[i+1]
res=0
for i in range(1, n): print(i, res); res += fac_val[3*i+1] + fac_val[i] - fac_val[2*i] - fac_val[2*i+1]
# Kenny Lau, Jun 09 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
R. J. Mathar, Sep 03 2011
STATUS
approved