A080321 a(n) = A080301(A080318(n)).
0, 4, 428, 58747, 1758473969, 340760636747, 14410746502617904, 673020037180959760871, 1736622037158911219053381734718, 400539731185759177060380684246324
Offset: 0
Keywords
Crossrefs
Cf. A080320.
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.
A080300 := n -> A080116(n)*A215406(n); # Untested (as of Aug 19 2012) A080300 := n -> `if`((0 = n) or (0 = A080116(n)),0, A014137(((A000523(n)+1)/2)-1)+A080301(n));
A080116[n_] := Module[{lev = 0, c = n}, While[c > 0, lev = lev + (-1)^c; c = Floor[c/2]; If[lev<0, Return[0]]]; If[lev>0, Return[0], Return[1]]]; A215406[n_] := Module[{m, d, a, y, t, x, u, v}, m = Quotient[Length[d = IntegerDigits[n, 2]], 2]; a = FromDigits[Reverse[d], 2]; y = 0; t = 1; For[x = 0, x <= 2*m - 2, x++, If[Mod[a, 2] == 1, y++, u = 2*m - x; v = m - Quotient[x + y, 2] - 1; t = t - Binomial[u - 1, v - 1] + Binomial[u - 1, v]; y--]; a = Quotient[a, 2]]; (1 - I*Sqrt[3])/2 - 4^(m + 1)*Gamma[m + 3/2]*Hypergeometric2F1[1, m + 3/2, m + 3, 4]/(Sqrt[Pi]*Gamma[m + 3]) -t]; a[n_] := A080116[n]*A215406[n] // Simplify; Table[a[n], {n, 0, 170}] (* Jean-François Alcover, Mar 05 2016 *)
0 stands for an empty parenthesization, thus a(0) = 1. 2 has binary expansion "10", which corresponds with "()", thus a(2) = 1. 3 has binary expansion "11", but "((" is not a well-formed parenthesization, thus a(3) = 0. 10 has binary expansion "1010", corresponding with a well-formed parenthesization "()()", thus a(10) = 1. 38 has binary expansion "100110", but "())(()" is not a well-formed parenthesization, thus a(38) = 0.
A080116 := proc(n) local c,lev; lev := 0; c := n; while(c > 0) do lev := lev + (-1)^c; c := floor(c/2); if(lev < 0) then RETURN(0); fi; od; if(lev > 0) then RETURN(0); else RETURN(1); fi; end;
A080116[n_] := (lev = 0; c = n; While[c > 0, lev = lev + (-1)^c; c = Floor[c/2]; If[lev < 0, Return[0]]]; If[lev > 0, Return[0], Return[1]]); Table[A080116[n], {n, 0, 104}] (* Jean-François Alcover, Jul 24 2013, translated from Maple *)
A080116(n) = { my(k=0); while(n, k += (-1)^n; n >>= 1; if(k<0, return(0))); (0==k); }; \\ Antti Karttunen, Aug 23 2019
def A080116(n) : lev = 0 while n > 0 : lev += (-1)^n if lev < 0: return 0 n = n//2 return 0 if lev > 0 else 1 [A080116(n) for n in (0..104)] # Peter Luschny, Aug 09 2012
Comments