cp's OEIS Frontend

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.

Previous Showing 21-30 of 32 results. Next

A132971 a(2*n) = a(n), a(4*n+1) = -a(n), a(4*n+3) = 0, with a(0) = 1.

Original entry on oeis.org

1, -1, -1, 0, -1, 1, 0, 0, -1, 1, 1, 0, 0, 0, 0, 0, -1, 1, 1, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 1, 0, 1, -1, 0, 0, 1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 1, 0, 1, -1, 0, 0, 1, -1, -1, 0, 0, 0, 0, 0, 1, -1
Offset: 0

Views

Author

Michael Somos, Sep 17 2007, Sep 19 2007

Keywords

Comments

If binary(n) has adjacent 1 bits then a(n) = 0 else a(n) = (-1)^A000120(n).
Fibbinary numbers (A003714) gives the numbers n for which a(n) = A106400(n). - Antti Karttunen, May 30 2017

Examples

			G.f. = 1 - x - x^2 - x^4 + x^5 - x^8 + x^9 + x^10 - x^16 + x^17 + x^18 + ...
		

Crossrefs

Cf. A085357 (gives the absolute values: -1 -> 1), A286576 (when reduced modulo 3: -1 -> 2).

Programs

  • Mathematica
    m = 100; A[_] = 1;
    Do[A[x_] = A[x^2] - x A[x^4] + O[x]^m // Normal, {m}];
    CoefficientList[A[x], x] (* Jean-François Alcover, Nov 16 2019 *)
  • PARI
    {a(n) = if( n<1, n==0, if( n%2, if( n%4 > 1, 0, -a((n-1)/4) ), a(n/2) ) )};
    
  • PARI
    {a(n) = my(A, m); if( n<0, 0, m = 1; A = 1 + O(x); while( m<=n, m *= 2; A = subst(A, x, x^2) - x * subst(A, x, x^4) ); polcoeff(A, n)) };
    
  • Python
    from sympy import mobius, prime, log
    import math
    def A(n): return n - 2**int(math.floor(log(n, 2)))
    def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))
    def a(n): return mobius(b(n)) # Indranil Ghosh, May 30 2017
  • Scheme
    (define (A132971 n) (cond ((zero? n) 1) ((even? n) (A132971 (/ n 2))) ((= 1 (modulo n 4)) (- (A132971 (/ (- n 1) 4)))) (else 0))) ;; Antti Karttunen, May 30 2017
    

Formula

A024490(n) = number of solutions to 2^n <= k < 2^(n+1) and a(k) = 1.
A005252(n) = number of solutions to 2^n <= k < 2^(n+1) and a(k) = -1.
A027935(n-1) = number of solutions to 2^n <= k < 2^(n+1) and a(k) = 0.
G.f. A(x) satisfies A(x) = A(x^2) - x * A(x^4).
G.f. B(x) of A000621 satisfies B(x) = x * A(x^2) / A(x).
a(n) = A008683(A005940(1+n)). [Analogous to Moebius mu] - Antti Karttunen, May 30 2017

A299759 Triangle read by rows in which row n lists in order all FDH numbers of strict integer partitions of n.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 7, 10, 12, 9, 14, 15, 24, 11, 18, 20, 21, 30, 13, 22, 27, 28, 40, 42, 16, 26, 33, 35, 36, 54, 56, 60, 17, 32, 39, 44, 45, 66, 70, 72, 84, 120, 19, 34, 48, 52, 55, 63, 78, 88, 90, 105, 108, 168, 23, 38, 51, 64, 65, 77, 96, 104, 110, 126
Offset: 1

Views

Author

Gus Wiseman, Feb 18 2018

Keywords

Comments

Let f(n) = A050376(n) be the n-th Fermi-Dirac prime. Every positive integer n has a unique factorization of the form n = f(s_1)*...*f(s_k) where the s_i are strictly increasing positive integers. This determines a unique strict integer partition (s_k...s_1) whose FDH number is then defined to be n.
This sequence is a permutation of the positive integers.

Examples

			Triangle of strict partitions begins:
                  0
                 (1)
                 (2)
               (3) (21)
               (4) (31)
             (5) (41) (32)
          (6) (51) (42) (321)
        (7) (61) (43) (52) (421)
     (8) (71) (62) (53) (431) (521)
(9) (81) (72) (54) (63) (621) (531) (432).
		

Crossrefs

Programs

  • Mathematica
    nn=25;
    FDprimeList=Select[Range[nn],MatchQ[FactorInteger[#],{{?PrimeQ,?(MatchQ[FactorInteger[2#],{{2,_}}]&)}}]&];
    Table[Sort[Times@@FDprimeList[[#]]&/@Select[IntegerPartitions[n],UnsameQ@@#&]],{n,0,Length[FDprimeList]}]

A005599 Running sum of every third term in the {+1,-1}-version of Thue-Morse sequence A010060.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 6, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 17, 18, 19, 18, 19, 20, 21, 20, 19, 18, 19, 18, 19, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 30, 29, 30, 31, 32, 33, 34, 35, 36, 35, 36, 35, 34, 33, 34, 35, 36, 35, 36, 37, 38, 39, 40, 41, 42, 43, 42, 43, 44, 45, 46, 47, 48, 47, 48, 49, 50
Offset: 0

Views

Author

M. R. Schroeder

Keywords

References

  • J.-P. Allouche and J. Shallit, Automatic Sequences, Cambridge Univ. Press, 2003, p. 98.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A000120 for "wt" (the binary weight of n).

Programs

  • Haskell
    a005599 n = a005599_list !! n
    a005599_list = scanl (+) 0 $ f a106400_list
       where f (x:::xs) = x : f xs
    -- Reinhard Zumkeller, May 26 2013
    
  • Maple
    A000120 := proc(n) local w,m,i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120;
    f:=n->add( (-1)^wt(3*k),k=0..n-1);
    [seq(f(n),n=0..50)]; # N. J. A. Sloane, Jul 22 2012
    A005599 := proc(n)
            add( A106400(3*i),i=0..n-1) ;
    end proc: # R. J. Mathar, Jul 22 2012
  • Mathematica
    wt[n_] := DigitCount[n, 2, 1]; a[n_] := Sum[(-1)^wt[3*k], {k, 0, n-1}]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 03 2014, after N. J. A. Sloane *)
  • PARI
    a(n) = sum(k=0, n-1, (-1)^hammingweight(3*k)); \\ Michel Marcus, Jul 03 2017

Formula

a(n) = Sum( (-1)^wt(3*k),k=0..n-1). See Allouche-Shallit for asymptotics. - From N. J. A. Sloane, Jul 22 2012
The generating function -(2*z^4+z^3+z+1)*(z^3-z^2-1)/(z^6+z^5+z^4+z^3+z^2+z+1)/(z-1)^2 proposed in the Plouffe thesis is wrong.

A343029 Number of 1-bits in the binary expansion of n which have an even number of 0-bits at less significant bit positions.

Original entry on oeis.org

0, 1, 0, 2, 1, 1, 0, 3, 0, 2, 1, 2, 2, 1, 0, 4, 1, 1, 0, 3, 1, 2, 1, 3, 0, 3, 2, 2, 3, 1, 0, 5, 0, 2, 1, 2, 2, 1, 0, 4, 1, 2, 1, 3, 2, 2, 1, 4, 2, 1, 0, 4, 1, 3, 2, 3, 0, 4, 3, 2, 4, 1, 0, 6, 1, 1, 0, 3, 1, 2, 1, 3, 0, 3, 2, 2, 3, 1, 0, 5, 1, 2, 1, 3, 2, 2, 1
Offset: 0

Views

Author

Kevin Ryde, Apr 03 2021

Keywords

Comments

Each term of Per Nørgård's infinity sequence (A004718) is a sum of +1 or -1 for each 1-bit of n according as that bit has an even or odd number of 0-bits below it. The present sequence counts the "+1" bits and A343030 counts the "-1" bits so that A004718(n) = a(n) - A343030(n).
a(n) and A343030(n) can be iterated together by pair [a(n-1)-t, A343030(n-1)+1] -> [a(n), A343030(n)] if t odd or [A343030(n), a(n)] if t even, where t = A007814(n) is the 2-adic valuation of n.
In the generating function sum below, k is a bit position (0 for the least significant bit). 1/2 of each sum term gives 1*x^n at those n where bit k of n is 1 and has an even number of 0 bits below. The product part is like the +-1 Thue-Morse sequence A106400, but only the k lowest bits, and each product term negated so parity of 0-bits. These +-1 are turned into 2 or 0 and shifted and repeated in blocks which are where bit k of n is 1.

Examples

			n = 860 = binary 1101011100
                 ^^   ^^^    a(n) = 5
		

Crossrefs

Cf. A343030, A004718, A000225 (indices of new highs).

Programs

  • PARI
    a(n) = my(t=1,ret=0); for(i=0,if(n,logint(n,2)), if(bittest(n,i), ret+=t, t=!t)); ret;
    
  • Python
    def a(n):
      b = bin(n)[2:]
      return sum(bi=='1' and b[i:].count('0')%2==0 for i, bi in enumerate(b))
    print([a(n) for n in range(87)]) # Michael S. Branicky, Apr 03 2021

Formula

a(n) = A004718(n) + A343030(n).
a(n) = A000120(n) - A343030(n), where A000120 is the number of 1-bits in n (binary weight).
a(2*n) = A000120(n) - a(n).
a(2*n+1) = a(n) + 1.
G.f. satisfies g(x) = (x-1)*g(x^2) + A000120(x^2) + x/(1-x^2).
G.f.: (1/2) * Sum_{k>=0} x^(2^k)*( (1-x^(2^k))/(1-x) + Prod_{j=0..k-1} x^(2^j)-1 )/( 1-x^(2*2^k) ).
a(2^n - 1) = n. - Michael S. Branicky, Apr 03 2021

A106407 Expansion of x((1-x)(1-x^2)(1-x^4)(1-x^8)...)^2.

Original entry on oeis.org

1, -2, -1, 4, -3, 2, 3, -8, 1, 6, -1, -4, 5, -6, -5, 16, -7, -2, 7, -12, 5, 2, -5, 8, 1, -10, -1, 12, -11, 10, 11, -32, 9, 14, -9, 4, 5, -14, -5, 24, -7, -10, 7, -4, -3, 10, 3, -16, 9, -2, -9, 20, -11, 2, 11, -24, 1, 22, -1, -20, 21, -22, -21, 64, -23, -18, 23, -28, 5, 18, -5, -8, 9, -10, -9, 28, -19, 10, 19, -48, 17, 14, -17, 20
Offset: 1

Views

Author

Michael Somos, May 02 2005

Keywords

Comments

The Stern polynomial B(n,x) evaluated at x=-2. See A125184. - T. D. Noe, Feb 28 2011
Self-convolution of the signed Thue-Morse sequence A106400. - Vladimir Reshetnikov, Apr 13 2018

Programs

  • Mathematica
    Table[Sum[(-1)^(DigitCount[k, 2, 1] + DigitCount[n-k-1, 2, 1]), {k, 0, n-1}], {n, 1, 80}] (* Vladimir Reshetnikov, Apr 13 2018 *)
  • PARI
    {a(n)=local(A,m); if(n<1,0,n--; A=1+x*O(x^n); m=1; while(m<=n, A*=(1-x^m); m*=2;); polcoeff(A^2,n))}

Formula

Euler transform of sequence b(n) where b(2^k)=-2 and zero otherwise.
G.f.: A(x) satisfies 0=f(A(x), A(x^2), A(x^3), A(x^6)) where f(u1, u2, u3, u6)=u1^3*u6 + 6*u1^2*u2*u6 + 9*u1*u2^2*u6 - u3*u2^3.
G.f.: x(Product_{k>=0} (1-x^(2^k)))^2.
G.f.: A(x) satisfies 0=f(A(x), A(x^2), A(x^4)) where f(u, v, w)=-v^3+4uvw+u^2w.

A292118 G.f.: 1 + 2*Sum_{k >= 1} (-1)^k*q^A003159(k).

Original entry on oeis.org

1, -2, 0, 2, -2, 2, 0, -2, 0, 2, 0, -2, 2, -2, 0, 2, -2, 2, 0, -2, 2, -2, 0, 2, 0, -2, 0, 2, -2, 2, 0, -2, 0, 2, 0, -2, 2, -2, 0, 2, 0, -2, 0, 2, -2, 2, 0, -2, 2, -2, 0, 2, -2, 2, 0, -2, 0, 2, 0, -2, 2, -2, 0, 2, -2, 2, 0, -2, 2, -2, 0, 2, 0, -2, 0, 2, -2
Offset: 0

Views

Author

N. J. A. Sloane, Sep 09 2017

Keywords

Crossrefs

First differences of A106400.

Programs

  • Mathematica
    Join[{1},Differences[(-1)^ThueMorse[Range[0,100]]]] (* Paolo Xausa, Dec 18 2023 *)

Formula

Andrews-Newman (2017) give many properties of this series.

A357761 a(n) = A227872(n) - A356018(n).

Original entry on oeis.org

1, 2, 0, 3, 0, 0, 2, 4, -1, 0, 2, 0, 2, 4, -2, 5, 0, -2, 2, 0, 2, 4, 0, 0, 1, 4, -2, 6, 0, -4, 2, 6, 0, 0, 2, -3, 2, 4, 0, 0, 2, 4, 0, 6, -4, 0, 2, 0, 3, 2, -2, 6, 0, -4, 2, 8, 0, 0, 2, -6, 2, 4, 0, 7, 0, 0, 2, 0, 0, 4, 0, -4, 2, 4, -2, 6, 2, 0, 2, 0, -1, 4, 0
Offset: 1

Views

Author

Amiram Eldar, Oct 12 2022

Keywords

Comments

The excess of the number of odious (A000069) divisors of n over the number of evil (A001969) divisors of n.
Every integer occurs in this sequence.

Crossrefs

Cf. A000005, A000069, A000290 (positions of odd terms), A001969, A027697, A027699, A106400, A227872, A230851 (positions of 0's), A356018, A357762.
Similar sequences: A046660, A048272.

Programs

  • Mathematica
    a[n_] := -DivisorSum[n, (-1)^DigitCount[#, 2, 1] &]; Array[a, 100]
  • PARI
    a(n) = -sumdiv(n, d, (-1)^hammingweight(d));

Formula

a(n) = -Sum_{d|n} A106400(d).
a(n) = A000005(n) - 2*A356018(n).
a(n) = 2*A227872(n) - A000005(n).
a(n) = 0 iff n is in A230851.
a(n) == 1 (mod 2) iff n is a square (A000290).
a(2^n) = n + 1.
a(p*2^n) = 0 when p is an evil prime (A027699).
a(p^2*2^n) = n + 1 when p is an evil prime (A027699) and p^2 is odious, and when p is an odd odious prime (A027697) and p^2 is evil.
a(p^2*2^n) = -(n+1) when p is an evil prime and p^2 is also evil.
a(p^2*2^n) = 3*(n+1) when p is an odd odious prime and p^2 is also odious.
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = -Sum_{k>=1} A106400(k)/k = 1.196283264... (A357762).

A373308 Expansion of Product_{n>=0} (1 - x^(2^n))^3.

Original entry on oeis.org

1, -3, 0, 8, -9, 3, 8, -24, 15, 19, -24, 0, 17, -27, 0, 64, -57, -21, 64, -72, 33, 53, -72, 24, 17, -51, 24, 64, -81, 27, 64, -192, 135, 107, -192, 120, 1, -171, 120, 152, -183, -27, 152, -192, 87, 163, -192, 0, 89, -75, 0, 136, -129, -21, 136, -216, 111, 179, -216, 0, 145, -219, 0, 512
Offset: 0

Views

Author

Paul D. Hanna, Jun 20 2024

Keywords

Comments

Equals the self-convolution cube of the signed Thue-Morse sequence A106400: [1, -1, -1, 1, -1, 1, 1, -1, ...].
Conjecture: a(3*n) == A001285(n) (mod 3) for n >= 0, where A001285 is the Thue-Morse sequence: [1, 2, 2, 1, 2, 1, 1, 2, ...].
Conjecture: a(3*n+1) and a(3*n+2) are divisible by 3 for n >= 0.
Conjecture: a(n) = 0 iff n = 3*A000695(k) - 1 for k >= 1, where A000695 lists sums of distinct powers of 4.

Examples

			G.f.: A(x) = 1 - 3*x + 8*x^3 - 9*x^4 + 3*x^5 + 8*x^6 - 24*x^7 + 15*x^8 + 19*x^9 - 24*x^10 + 17*x^12 - 27*x^13 + 64*x^15 - 57*x^16 - 21*x^17 + 64*x^18 + ...
where A(x) = (1-x)^3 * (1-x^2)^3 * (1-x^4)^3 * (1-x^8)^3 * (1-x^16)^3 * ...
Notice that a(n) = 0 at n = [2, 11, 14, 47, 50, 59, 62, 191, 194, 203, 206, 239, 242, 251, 254, 767, ...] which appears to equal 3*A000695(k) - 1 for k >= 1.
		

Crossrefs

Programs

  • PARI
    {a(n) = my(A = prod(k=0,#binary(n), (1 - x^(2^k))^3 +x*O(x^n))); polcoeff(A, n)}
    for(n=0,60, print1(a(n),", "))

Formula

G.f. A(x) = Sum_{n>=0} a(n)*x^n satisfies the following formulas.
(1) A(x) = Product_{n>=0} (1 - x^(2^n))^3.
(2) A(x) = (1-x)^3 * A(x^2).
(3) a(n) = Sum_{k=0..n} A106400(k) * A106407(n-k+1) for n >= 0.

A268676 a(n) = A101080(n,A268823(3+n)), where A101080(x,y) gives the Hamming distance between binary expansions of x and y.

Original entry on oeis.org

1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 1, 3, 3, 1, 3, 1, 1, 3, 3, 1, 1, 3, 1, 3, 3, 1, 3, 1, 1, 3, 1, 3, 3, 1, 1
Offset: 0

Views

Author

Antti Karttunen, Feb 19 2016

Keywords

Comments

It seems that A001969 gives the positions of 1's, while A000069 gives the positions of 3's.
The above observation follows because by definition, a(n) gives the Hamming distance between binary expansions of n and A003188(3+A006068(n)). To see how this leads to the stated claim, consider the illustration "Visualized as a traversal of vertices of a tesseract" in the Wikipedia article "Gray code". Starting from any vertex with either (A) an even, or (B) an odd number of 1-bits, traverse three edges along the red path, to the direction indicated by the arrow, and then note the Hamming distance between the starting and the ending vertex. It is always 1 in case (A), and 3 in case (B), because the position of the flipped bit is given by sequence A007814, with its every other term zero, so in case (A) the third flip cancels the first flip (both toggling the rightmost bit), which leaves only the second bit-flip effective. Note that the properties of a tesseract generalize to those of an infinite dimensional hypercube. - Antti Karttunen, Mar 11 2024

Crossrefs

Programs

Formula

a(n) = A101080(n,A268823(3+n)), where A101080(x,y) gives the Hamming distance between binary expansions of x and y.
a(n) = 2 - (-1)^A000120(n) = 2 - A106400(n). - Lorenzo Sauras Altuzarra, Mar 10 2024
a(n) = 1 + 2 * A010060(n). - Joerg Arndt, Mar 11 2024

A309303 Expansion of g.f. (sqrt(x+1) - sqrt(1-3*x))/(2*(x+1)^(3/2)).

Original entry on oeis.org

0, 1, -1, 2, -1, 4, 2, 13, 23, 68, 164, 439, 1146, 3067, 8231, 22306, 60791, 166684, 459308, 1271479, 3534116, 9859573, 27598757, 77490472, 218183522, 615902899, 1742738477, 4942022648, 14043034703, 39979680748, 114020882010, 325721340061
Offset: 0

Views

Author

Vladimir Reshetnikov, Jul 21 2019

Keywords

Comments

(-1)^a(n) = (-1)^A010060(n) = A106400(n) (Thue-Morse sequence).
a(n) + a(n+1) = A005043(n) = (-1)^n * hypergeom([-n, 1/2], [2], 4) (Motzkin sums).

Crossrefs

Programs

  • Maple
    f:= gfun:-rectoproc({n*a(n) = (n-4)*a(n-1) + (n-2)*(5*a(n-2) + 3*a(n-3)),a(0)=0,a(1)=1,a(2)=-1},a(n),remember):
    map(f, [$0..40]); # Robert Israel, Jul 23 2019
  • Mathematica
    Table[(-1)^n/2 + 3^(n + 3/2)/2^(n + 4) (2 n - 3)!!/n! Hypergeometric2F1[3/2, 3/2, 3/2 - n, 1/4], {n, 0, 31}]

Formula

a(n) = (-1)^n/2 + 3^(n+3/2)/2^(n+4) * (2*n-3)!!/n! * hypergeom([3/2, 3/2], [3/2 - n], 1/4).
D-finite with recurrence: n*a(n) = (n-4)*a(n-1) + (n-2)*(5*a(n-2) + 3*a(n-3)).
a(n) ~ c * 3^n / n^(3/2), where c = 3^(3/2) / (32*sqrt(Pi)) = 0.09161297...
Previous Showing 21-30 of 32 results. Next