A115637 In the binary expansion of n+2, transform 0->1 and 1->0 then interpret as base 4.
1, 0, 5, 4, 1, 0, 21, 20, 17, 16, 5, 4, 1, 0, 85, 84, 81, 80, 69, 68, 65, 64, 21, 20, 17, 16, 5, 4, 1, 0, 341, 340, 337, 336, 325, 324, 321, 320, 277, 276, 273, 272, 261, 260, 257, 256, 85, 84, 81, 80, 69, 68, 65, 64, 21, 20, 17, 16, 5, 4, 1, 0, 1365, 1364, 1361, 1360, 1349
Offset: 0
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..16384 (first 1025 terms from Antti Karttunen)
- Ralf Stephan, Divide-and-conquer generating functions. I. Elementary sequences, arXiv:math/0307027 [math.CO], 2003, see equation 2.4 with a(n) = a_{n+2} for case alpha=4, c=1, d=0.
Programs
-
Maple
b:= n-> 1-(n mod 2)+`if`(n<2, 0, b(iquo(n, 2))*4): a:= n-> b(n+2): seq(a(n), n=0..66); # Alois P. Heinz, Jul 16 2024
-
Mathematica
A115637[n_] := FromDigits[1 - IntegerDigits[n + 2, 2], 4]; Array[A115637, 100, 0] (* Paolo Xausa, Jul 16 2024 *)
-
PARI
up_to = 1024; A115633array(n, k) = (((-1)^n)*if(n==k,1, if((k+k+2)==n, -4, if((k+1)==n, -(1+(-1)^k)/2, 0)))); A115637list(up_to) = { my(mA115633=matrix(up_to,up_to,n,k,A115633array(n-1,k-1)), mA115636 = matsolve(mA115633,matid(up_to)), v = vector(up_to)); for(n=1,up_to,v[n] = vecsum(mA115636[n,])); (v); }; v115637 = A115637list(up_to+1); A115637(n) = v115637[1+n]; \\ Antti Karttunen, Nov 02 2018
-
PARI
a(n) = fromdigits([!b |b<-binary(n+2)], 4); \\ Kevin Ryde, Jul 15 2024
-
Python
def A115637(n): return int(bin((~(n+2))^(-1<<(n+2).bit_length()))[2:],4) # Chai Wah Wu, Jul 17 2024
Formula
G.f.: (1/(1-x))*Sum_{k>=0} 4^k*x^(2^(k+1)-2)/(1+x^(2^k)); the g.f. G(x) satisfies G(x) - 4(1+x)*x^2*G(x^2) = 1/(1-x^2).
Extensions
New name from Kevin Ryde, Jul 15 2024
Comments