A168181 Characteristic function of numbers that are not multiples of 8.
0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0
Offset: 0
Examples
G.f. = x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^9 + x^10 + x^11 + ...
Links
- Antti Karttunen, Table of n, a(n) for n = 0..16384
- Index entries for characteristic functions
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,1).
Crossrefs
Programs
-
Magma
[Sign(n mod 8) : n in [0..100]]; // Wesley Ivan Hurt, Jun 21 2014
-
Maple
with(numtheory); A168181:=n->signum(n mod 8); seq(A168181(n), n=0..100); # Wesley Ivan Hurt, Jun 21 2014
-
Mathematica
Table[Sign[Mod[n,8]], {n, 0, 100}] (* Wesley Ivan Hurt, Jun 21 2014 *)
-
PARI
a(n)=n%8 > 0 \\ Felix Fröhlich, Aug 11 2014
-
Python
def A168181(n): return int(bool(n&7)) # Chai Wah Wu, Jul 09 2022
Formula
a(n+8) = a(n);
A033440(n) = Sum_{k=0..n} a(k)*(n-k).
Dirichlet g.f. (1-1/8^s)*zeta(s). - R. J. Mathar, Feb 19 2011
For the general case: the characteristic function of numbers that are not multiples of m is a(n) = floor((n-1)/m) - floor(n/m) + 1, m,n > 0. - Boris Putievskiy, May 08 2013
a(n) = sign(n mod 8). - Wesley Ivan Hurt, Jun 21 2014
a(n) = sign( 1 - floor(cos(Pi*n/4)) ). - Wesley Ivan Hurt, Jun 21 2014
Euler transform of length 8 sequence [ 1, 0, 0, 0, 0, 0, -1, 1]. - Michael Somos, Jun 24 2014
Moebius transform is length 8 sequence [ 1, 0, 0, 0, 0, 0, 0, -1]. - Michael Somos, Jun 24 2014
G.f.: x * (1 - x^7) / ((1 - x) * (1 - x^8)). - Michael Somos, Jun 24 2014
a(n) = 1-A253513(n). - Antti Karttunen, Oct 08 2017
Comments