A130909 Simple periodic sequence (n mod 16).
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1).
Crossrefs
Programs
-
PARI
a(n)=n%16 \\ Charles R Greathouse IV, Jul 13 2016
-
Python
def A130909(n): return n&15 # Chai Wah Wu, Jan 18 2023
Formula
a(n) = n mod 16 = n-16*floor(n/16).
G.f.: g(x) = (Sum_{k=1..15} k*x^k)/(1-x^16).
G.f.: g(x) = x(15x^16-16x^15+1)/((1-x^16)(1-x)^2).
a(n) = (1/2)*(15 - ( - 1)^n - 2*( - 1)^(b/4) - 4*( - 1)^((b - 2 + 2*( - 1)^(b/4))/8) - 8*( - 1)^((b - 6 + ( - 1)^n + 2*( - 1)^(b/4) + 4*( - 1)^((b - 2 + 2*( - 1)^(b/4))/8))/16)) where b = 2n - 1 + ( - 1)^n.
a(n) = n mod 2+2*(floor(n/2)mod 2)+4*(floor(n/4)mod 2)+8*(floor(n/8)mod 2).
a(n) = (1/2)*(15-(-1)^n-2*(-1)^floor(n/2)-4*(-1)^floor(n/4)-8*(-1)^floor(n/= 8)).
Complex representation: a(n) = (1/16)*(1-r^n)*sum{1<=k<16, k*product{1<=m<16,m<>k, (1-r^(n-m))}} where r=exp(Pi/8*i)=(sqrt(2+sqrt(2))+i*sqrt(2-sqrt(2)))/2 and i=sqrt(-1).
Trigonometric representation: a(n) = 2^22*(sin(n*Pi/16))^2*sum{1<=k<16, k*product{1<=m<16,m<>k, (sin((n-m)*Pi/16))^2}}.
a(n) = (1/2)*(15-(-1)^p(0,n)-2*(-1)^p(1,n)-4*(-1)^p(2,n)-8*(-1)^p(3,n)) where p(k,n) is defined recursively by p(0,n)=n, p(k,n)=1/4*(2*p(k-1,n)-1+(-1)^p(k-1,n)).
Comments