login
a(n) = c(n,n-1,...,1), the Cantor tuple function c applied to n-tuple (n,n-1,...,1).
3

%I #12 May 30 2018 03:30:04

%S 0,1,7,172,159331,457962302281,34728196483190756583320206,

%T 10559069708767287358379688495183368797732655643889529662

%N a(n) = c(n,n-1,...,1), the Cantor tuple function c applied to n-tuple (n,n-1,...,1).

%H Alois P. Heinz, <a href="/A226598/b226598.txt">Table of n, a(n) for n = 0..10</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Pairing_function">Pairing function</a>

%F a(n) = c(n,n-1,...,1) with c() = 0, c(n) = n, c(n,k) = (n+k)*(n+k+1)/2+k, c(n_1,...,n_{k-1},n_k) = c(c(n_1,...,n_{k-1}),n_k) for k>2.

%e a(2) = c(2,1) = 3*4/2+1 = 7.

%e a(3) = c(3,2,1) = c(c(3,2),1) = c(5*6/2+2,1) = c(17,1) = 18*19/2+1 = 172.

%p c:= proc() `if`(nargs=0, 0,

%p `if`(nargs=1, args,

%p `if`(nargs=2, ((n, k)-> (s-> s*(s+1)/2)(n+k)+k)(args),

%p c(c(args[1..-2]), args[-1]))))

%p end:

%p a:= n-> c((n-i)$i=0..n-1):

%p seq(a(n), n=0..10);

%t c[args_List] := Switch[Length[args], 0, {0}, 1, args, 2, {Function[s, s*(s + 1)/2][#[[1]] + #[[2]]] + #[[2]]&[args]}, _, c[Append[c[args[[1 ;; -2]] ], args[[-1]]]]];

%t a[n_] := c[Table[(n - i), {i, 0, n - 1}]][[1]];

%t Table[a[n], {n, 0, 10}] (* _Jean-François Alcover_, May 30 2018, from Maple *)

%Y Cf. A226588, A226597.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Jun 13 2013