login
A182929
The rows of the binomial triangle reduced to balanced ternary lists encoded as decimal numbers.
1
0, 1, 4, 7, 16, 61, 160, 547, 1456, 5110, 13120, 44287, 118096, 398581, 1075840, 3720094, 9565936, 32285041, 86093440, 290565367, 774840976, 2711943430, 7059662080, 23535794707, 61987278400, 212693848522, 564945153280, 1979718703900, 5083731656656
OFFSET
0,3
COMMENTS
Define an operation ~: ZxZ -> {-1,0,1} (Z integers) by b ~ n = (b sigmod n) [|b sigmod n|=1]. Here [] is the Iverson bracket and sigmod is the signed mod operation defined as b sigmod n = b - n*ceil(b/n - 1/2) if n <> 0 and b otherwise. Further let T(n) = list_{k=0..n-1} binomial(n-1,k) ~ n for n > 1 and n if n is 0 or 1. We call T(n) the binomial notation of n.
A non-obvious arithmetical property of the binomial triangle becomes apparent from these balanced ternary lists: the rows which have an odd prime number as an index and only these rows are represented by a ternary list where 1 and -1 are alternating. One might also say that an odd integer is prime iff n > 1 and its binomial notation is zerofree.
Finally a(n) = Sum_{k=0..n-1} T(n)[k]*3^k.
The sequence starts at n=0 although the definitions can be extended to the negative integers by flipping the signs of the ternary digits. To illustrate the definitions:
n T(n) a(n)
----------------------------------
[-6] -1, 1, 0, 0, 1, -1 [-160]
[-5] -1, 1, -1, 1, -1 [ -61]
[-4] -1, 1, 1, -1 [ -16]
[-3] -1, 1, -1 [ -7]
[-2] -1, -1 [ -4]
[-1] -1 [ -1]
[ 0] 0 [ 0]
[ 1] 1 [ 1]
[ 2] 1, 1 [ 4]
[ 3] 1, -1, 1 [ 7]
[ 4] 1, -1, -1, 1 [ 16]
[ 5] 1, -1, 1, -1, 1 [ 61]
[ 6] 1, -1, 0, 0, -1, 1 [ 160]
MAPLE
A182929 := proc(n) local lop, k, Tlist;
lop := proc(a, n) if n = 0 then a else mods(a, n);
`if`(abs(%)=1, %, 0) fi end;
Tlist := proc(n) `if`(abs(n)<2, n, seq(signum(n)*
lop(binomial(abs(n)-1, k), n), k=0..abs(n)-1)) end:
[Tlist(n)]; signum(n)*add(3^k*%[k+1], k=0..abs(n)-1) end:
seq(A182929(n), n=0..30);
MATHEMATICA
lop[a_, n_] := Module[{m}, m = If[n == 0, a, Mod[a, n, -Quotient[Abs[n]-1, 2]]]; If[Abs[m] == 1, m, 0]];
Tlist[n_] := If[Abs[n]<2, {n}, Table[Sign[n]*lop[Binomial[Abs[n]-1, k], n], {k, 0, Abs[n]-1}]];
a[n_] := Module[{t=Tlist[n]}, Sign[n]*Sum[3^k*t[[k+1]], {k, 0, Abs[n]-1}]];
Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Jun 22 2019, from Maple *)
PROG
(PARI)
a(n) = {
if (n == 0, 0,
subst(apply(r->if(r==1, 1, r==n-1, -1, 0), lift(Mod(1+'x, n)^(n-1))), 'x, 3));
};
vector(29, n, a(n-1)) \\ Gheorghe Coserea, Nov 21 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Mar 16 2011
STATUS
approved