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 11-20 of 20 results.

A053633 Triangular array T(n,k) giving coefficients in expansion of Product_{j=1..n} (1+x^j) mod x^(n+1)-1.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 2, 2, 2, 4, 3, 3, 3, 3, 6, 5, 5, 6, 5, 5, 10, 9, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16, 16, 30, 28, 28, 29, 28, 28, 29, 28, 28, 52, 51, 51, 51, 51, 52, 51, 51, 51, 51, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 172, 170, 170, 172, 170, 170, 172
Offset: 0

Views

Author

N. J. A. Sloane, Mar 22 2000

Keywords

Comments

T(n,k) = number of binary vectors (x_1,...,x_n) satisfying Sum_{i=1..n} i*x_i = k (mod n+1) = size of Varshamov-Tenengolts code VT_k(n).

Examples

			Triangle begins:
  k  0    1    2    3    4    5    6    7    8    9
n
0    1;
1    1,   1;
2    2,   1,   1;
3    2,   2,   2,   2;
4    4,   3,   3,   3,   3;
5    6,   5,   5,   6,   5,   5;
6   10,   9,   9,   9,   9,   9,   9;
7   16,  16,  16,  16,  16,  16,  16,  16;
8   30,  28,  28,  29,  28,  28,  29,  28,  28;
9   52,  51,  51,  51,  51,  52,  51,  51,  51,  51;
    ...
[Edited by _Seiichi Manyama_, Mar 11 2018]
		

References

  • B. D. Ginsburg, On a number theory function applicable in coding theory, Problemy Kibernetiki, No. 19 (1967), pp. 249-252.

Crossrefs

Cf. A053632, A063776, A300328, A300628. Leading coefficients give A000016, next column gives A000048.

Programs

  • Maple
    with(numtheory): A053633 := proc(n,k) local t1,d; t1 := 0; for d from 1 to n do if n mod d = 0 and d mod 2 = 1 then t1 := t1+(1/(2*n))*2^(n/d)*phi(d)*mobius(d/gcd(d,k))/phi(d/gcd(d,k)); fi; od; t1; end;
  • Mathematica
    Flatten[ Table[ CoefficientList[ PolynomialMod[ Product[1+x^j, {j,1,n}], x^(n+1)-1], x], {n,0,11}]] (* Jean-François Alcover, May 04 2011 *)

Formula

The Maple code gives an explicit formula.

A053634 a(n) = Sum_{ d divides n } phi(d)*2^(n/d)/(2n).

Original entry on oeis.org

2, 3, 4, 7, 10, 18, 30, 54, 94, 176, 316, 591, 1096, 2058, 3856, 7301, 13798, 26244, 49940, 95373, 182362, 349626, 671092, 1290714, 2485534, 4793790, 9256396, 17896284, 34636834, 67109898, 130150588, 252647064, 490853416, 954440950
Offset: 3

Views

Author

N. J. A. Sloane, Mar 23 2000

Keywords

Comments

Offset is 3 because a(2) is 3/2, not an integer. - Michel Marcus, Sep 11 2013

Crossrefs

Programs

  • Mathematica
    a[n_] := DivisorSum[n, EulerPhi[#]*2^(n/#)&]/(2n); Table[a[n], {n, 3, 36}] (* Jean-François Alcover, Dec 07 2015 *)
  • PARI
    a(n) = sumdiv (n, d, eulerphi(d)*2^(n/d)/(2*n));  \\ Michel Marcus, Sep 11 2013

Formula

a(n) = A000031(n)/2.

A053636 a(n) = Sum_{odd d|n} phi(d)*2^(n/d).

Original entry on oeis.org

0, 2, 4, 12, 16, 40, 72, 140, 256, 540, 1040, 2068, 4128, 8216, 16408, 32880, 65536, 131104, 262296, 524324, 1048640, 2097480, 4194344, 8388652, 16777728, 33554600, 67108912, 134218836, 268435552, 536870968, 1073744160, 2147483708
Offset: 0

Views

Author

N. J. A. Sloane, Mar 23 2000

Keywords

Examples

			2*x + 4*x^2 + 12*x^3 + 16*x^4 + 40*x^5 + 72*x^6 + 140*x^7 + 256*x^8 + 540*x^9 + ...
		

Crossrefs

Programs

  • Haskell
    a053636 0 = 0
    a053636 n = sum $ zipWith (*) (map a000010 ods) (map ((2 ^) . (div n)) ods)
                where ods = a182469_row n
    -- Reinhard Zumkeller, Sep 13 2013
    
  • Mathematica
    a[ n_] := If[ n < 1, 0, Sum[ Mod[ d, 2] EulerPhi[ d] 2^(n / d), {d, Divisors[ n]}]] (* Michael Somos, May 09 2013 *)
  • PARI
    {a(n) = if( n<1, 0, sumdiv( n, d, (d % 2) * eulerphi(d) * 2^(n / d)))} /* Michael Somos, May 09 2013 */
    
  • Python
    from sympy import totient, divisors
    def A053636(n): return (sum(totient(d)<>(~n&n-1).bit_length(),generator=True))<<1) # Chai Wah Wu, Feb 21 2023

Formula

a(n) = n * A063776(n).
a(n) = Sum_{k=1..A001227(n)} A000010(A182469(n,k)) * 2^(n/A182469(n, A001227(n)+1-k)). - Reinhard Zumkeller, Sep 13 2013
G.f.: Sum_{m >= 0} phi(2*m + 1)*2*x^(2*m + 1)/(1 - 2*x^(2*m + 1)). - Petros Hadjicostas, Jul 20 2019

A267632 Triangle T(n, k) read by rows: the k-th column of the n-th row lists the number of ways to select k distinct numbers (k >= 1) from [1..n] so that their sum is divisible by n.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 2, 2, 1, 1, 1, 2, 4, 3, 1, 0, 1, 3, 5, 5, 3, 1, 1, 1, 3, 7, 9, 7, 3, 1, 0, 1, 4, 10, 14, 14, 10, 4, 1, 1, 1, 4, 12, 22, 26, 20, 12, 5, 1, 0, 1, 5, 15, 30, 42, 42, 30, 15, 5, 1, 1, 1, 5, 19, 42, 66, 76, 66, 43, 19, 5, 1, 0
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 18 2016

Keywords

Comments

Row less the last element is palindrome for n=odd or n=power of 2 where n is the row number (observation-conjecture).
From Petros Hadjicostas, Jul 13 2019: (Start)
By reading carefully the proof of Lemma 5.1 (pp. 65-66) in Barnes (1959), we see that he actually proved a general result (even though he does not state it in the lemma).
According to the definition of this sequence, for 1 <= k <= n, T(n, k) is the number of unordered sets b_1, b_2, ..., b_k of k distinct integers from 1..n such that b_1 + b_2 + ... + b_k = 0 (mod n). The proof of Lemma 5.1 in Barnes (1959) implies that T(n, k) = (1/n) * Sum_{s | gcd(n, k)} (-1)^(k - (k/s)) * phi(s) * binomial(n/s, k/s) for 1 <= k <= n.
For fixed k >= 1, the g.f. of the column (T(n, k): n >= 1) (with T(n, k) = 0 for 1 <= n < k) is (x^k/k) * Sum_{s|k} phi(s) * (-1)^(k - (k/s)) / (1 - x^s)^(k/s), which generalizes Herbert Kociemba's formula from A032801.
Barnes' (1959) formula is a special case of Theorem 4 (p. 66) in Ramanathan (1944). If R(n, k, v) is the number of unordered sets b_1, b_2, ..., b_k of k distinct integers from 1..n such that b_1 + b_2 + ... + b_k = v (mod n), then he proved that R(n, k, v) = (1/n) * Sum_{s | gcd(n,k)} (-1)^(k - (k/s)) * binomial(n/s, k/s) * C_s(v), where C_s(v) = A054535(s, v) = Sum_{d | gcd(s,v)} d * Moebius(s/d) is Ramanujan's sum (even though it was first discovered around 1900 by the Austrian mathematician R. D. von Sterneck).
Because C_s(v = 0) = phi(s), we get Barnes' (implicit) result; i.e., R(n, k, v=0) = T(n, k) for 1 <= k <= n.
For k=2, we have R(n, k=2, v=0) = T(n, k=2) = A004526(n-1) for n >= 1. For k=3, we have R(n, k=3, v=0) = T(n, k=3) = A058212(n) for n >= 1. For k=4, we have R(n, k=4, v=0) = A032801(n) for n >= 1. For k=5, we have R(n, k=5, v=0) = T(n, k=5) = A008646(n-5) for n >= 5.
The reason we have T(2*m+1, k) = A037306(2*m+1, k) = A047996(2*m+1, k) for m >= 0 and k >= 1 is the following. When n = 2*m + 1, all divisors s of gcd(n, k) are odd. In such a case, k - (k/s) is even for all k >= 1, and thus (-1)^(k - (k/s)) = 1, and thus T(n = 2*m+1, k) = (1/n) * Sum_{s | gcd(n, k)} phi(s) * binomial(n/s, k/s) = A037306(2*m+1, k) = A047996(2*m+1, k).
By summing the products of the g.f. of column k times y^k from k = 1 to k = infinity, we get the bivariate g.f. for the array: Sum_{n, k >= 1} T(n, k)*x^n*y^k = Sum_{s >= 1} (phi(s)/s) * log((1 - x^s + (-x*y)^s)/(1 - x^s)) = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s).
Letting y = 1 in the above bivariate g.f., we get the g.f. of the sequence (Sum_{1 <= k <= n} T(n, k): n >= 1) is -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x)^s) = -x/(1 - x) + Sum_{m >= 0} (phi(2*m + 1)/(2*m + 1)) * log(1 - 2*x^(2*m+1)), which is the g.f. of sequence A082550. Hence, sequence A082550 consists of the row sums.
There is another important interpretation of this array T(n, k) which is related to some of the references for sequence A047996, but because the discussion is too lengthy, we omit the details.
(End)

Examples

			For n = 5, there is one way to pick one number (5), two ways to pick two numbers (1+4, 2+3), two ways to pick 3 numbers (1+4+5, 2+3+5), one way to pick 4 numbers (1+2+3+4), and one way to pick 5 numbers (1+2+3+4+5) so that their sum is divisible by 5. Therefore, T(5,1) = 1, T(5,2) = 2, T(5,3) = 2, T(5,4) = 1, and T(5,5) = 1.
Table for T(n,k) begins as follows:
n\k 1 2   3    4    5    6    7    8    9   10
1   1
2   1 0
3   1 1   1
4   1 1   1    0
5   1 2   2    1    1
6   1 2   4    3    1    0
7   1 3   5    5    3    1    1
8   1 3   7    9    7    3    1    0
9   1 4  10   14   14   10    4    1    1
10  1 4  12   22   26   20   12    5    1    0
...
		

Crossrefs

Programs

  • Maple
    A267632 := proc(n,k)
        local a,msel,p;
        a := 0 ;
        for msel in combinat[choose](n,k) do
            if modp(add(p,p=msel),n) = 0 then
                a := a+1 ;
            end if;
        end do:
        a;
    end proc: # R. J. Mathar, May 15 2016
    # second Maple program:
    b:= proc(n, m, s) option remember; expand(`if`(n=0,
          `if`(s=0, 1, 0), b(n-1, m, s)+x*b(n-1, m, irem(s+n, m))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=1..n))(b(n$2, 0)):
    seq(T(n), n=1..14);  # Alois P. Heinz, Aug 27 2018
  • Mathematica
    f[k_, n_] :=  Length[Select[Select[Subsets[Range[n]], Length[#] == k &], IntegerQ[Total[#]/n] &]];MatrixForm[Table[{n, Table[f[k, n], {k, n}]}, {n, 10}]] (* Dimitri Papadopoulos, Jan 18 2016 *)

Formula

T(2n+1, k) = A037306(2n+1, k) = A047996(2n+1, k).
From Petros Hadjicostas, Jul 13 2019: (Start)
T(n, k) = (1/n) * Sum_{s | gcd(n, k)} (-1)^(k - (k/s)) * phi(s) * binomial(n/s, k/s) for 1 <= k <= n.
G.f. for column k >= 1: (x^k/k) * Sum_{s|k} phi(s) * (-1)^(k - (k/s)) / (1 - x^s)^(k/s).
Bivariate g.f.: Sum_{n, k >= 1} T(n, k)*x^n*y^k = -x/(1 - x) - Sum_{s >= 1} (phi(s)/s) * log(1 - x^s + (-x*y)^s).
(End)
Sum_{k=1..n} k * T(n,k) = A309122(n). - Alois P. Heinz, Jul 13 2019

A064355 Number of subsets of {1,2,..n} that sum to 1 mod n.

Original entry on oeis.org

2, 2, 2, 4, 6, 10, 18, 32, 56, 102, 186, 340, 630, 1170, 2182, 4096, 7710, 14560, 27594, 52428, 99858, 190650, 364722, 699040, 1342176, 2581110, 4971008, 9586980, 18512790, 35791358, 69273666, 134217728, 260300986, 505290270, 981706806, 1908874240, 3714566310
Offset: 1

Views

Author

Dan Fux (dan.fux(AT)OpenGaia.com or danfux(AT)OpenGaia.com), Sep 25 2001

Keywords

Examples

			a(7) = 18 because there are 18 subsets of {1,2,3,4,5,6,7} which sum to 1 mod 7:{1}, {1,7}, {2,6}, {3,5}, {1,2,5}, {1,3,4}, {2,6,7}, {3,5,7}, {4,5,6}, {1,2,5,7}, {1,3,4,7}, {1,3,5,6}, {2,3,4,6}, {4,5,6,7}, {1,2,3,4,5}, {1,3,5,6,7}, {2,3,4,6,7}, {1,2,3,4,5,7}.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{d = Select[Divisors@n, OddQ@ # &]}, Plus @@ (2^(n/d)*MoebiusMu@d)/n]; Array[a, 35] (* Robert G. Wilson v, Feb 20 2006 *)
  • PARI
    a(n) = sumdiv(n, d, (d % 2) * 2^(n/d) * moebius(d)) / n; \\ Amiram Eldar, Jun 05 2025

Formula

a(n) = 2*A000048(n).
a(n) = (1/n) * sum_{d divides n and d is odd} 2^(n/d) * mu(d); (mu(d) is the Moebius function, sequence A008683).

Extensions

More terms from Vladeta Jovovic, Sep 27 2001

A309128 (1/n) times the sum of the elements of all subsets of [n] whose sum is divisible by n.

Original entry on oeis.org

1, 1, 4, 4, 12, 20, 40, 70, 150, 284, 564, 1116, 2212, 4392, 8768, 17404, 34704, 69214, 137980, 275264, 549340, 1096244, 2188344, 4369196, 8724196, 17422500, 34797476, 69505628, 138845940, 277383904, 554189344, 1107296248, 2212559996, 4421289872, 8835361488
Offset: 1

Views

Author

Alois P. Heinz, Jul 13 2019

Keywords

Examples

			The subsets of [5] whose sum is divisible by 5 are: {}, {5}, {1,4}, {2,3}, {1,4,5}, {2,3,5}, {1,2,3,4}, {1,2,3,4,5}.  The sum of their elements is 0 + 5 + 5 + 5 + 10 + 10 + 10 + 15 = 60.  So a(5) = 60/5 = 12.
		

Crossrefs

Cf. A000010, A001792 (the same for all subsets), A053636, A063776, A309122, A309280.

Programs

  • Maple
    b:= proc(n, m, s) option remember; `if`(n=0, [`if`(s=0, 1, 0), 0],
          b(n-1, m, s) +(g-> g+[0, g[1]*n])(b(n-1, m, irem(s+n, m))))
        end:
    a:= proc(n) option remember; forget(b); b(n$2, 0)[2]/n end:
    seq(a(n), n=1..40);
  • Mathematica
    b[n_, m_, s_] := b[n, m, s] = If[n == 0, {If[s == 0, 1, 0], 0},
         b[n-1, m, s] + Function[g, g+{0, g[[1]] n}][b[n-1, m, Mod[s+n, m]]]];
    a[n_] := b[n, n, 0][[2]]/n;
    Table[a[n], {n, 1, 40}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)

Formula

Conjecture: a(n) = (n + 1) * A063776(n)/4 - (phi(n)/2) * (1 + (-1)^n)/2 = ((n + 1)/(4*n)) * A053636(n) - (phi(n)/2) * (1 + (-1)^n)/2. - Petros Hadjicostas, Jul 20 2019
a(n) = A309280(n,n). - Alois P. Heinz, Jul 21 2019

A300218 Number of solutions to 1 +- 3 +- 5 +- ... +- (2*n-1) == 0 mod n.

Original entry on oeis.org

1, 2, 2, 4, 4, 12, 10, 36, 30, 104, 94, 344, 316, 1172, 1096, 4132, 3856, 14572, 13798, 52432, 49940, 190652, 182362, 699416, 671092, 2581112, 2485534, 9586984, 9256396, 35791472, 34636834, 134221860, 130150588, 505290272, 490853416, 1908874584, 1857283156
Offset: 1

Views

Author

Seiichi Manyama, Feb 28 2018

Keywords

Examples

			Solutions for n = 7:
----------------------------
1 +3 +5 +7 +9 +11 +13 =  49.
1 +3 +5 -7 +9 +11 +13 =  35.
1 +3 -5 +7 -9 +11 +13 =  21.
1 +3 -5 -7 -9 +11 +13 =   7.
1 -3 +5 +7 +9 -11 +13 =  21.
1 -3 +5 -7 +9 -11 +13 =   7.
1 -3 -5 +7 +9 +11 -13 =   7.
1 -3 -5 +7 -9 -11 +13 =  -7.
1 -3 -5 -7 +9 +11 -13 =  -7.
1 -3 -5 -7 -9 -11 +13 = -21.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i, m) option remember; `if`(i<1, `if`(n=0, 1, 0),
          add(b(irem(n+j, m), i-2, m), j=[i, m-i]))
        end:
    a:= n-> b(n-1, 2*n-3, n):
    seq(a(n), n=1..40);  # Alois P. Heinz, Mar 01 2018
  • Mathematica
    Table[With[{s = Range[1, (2 n - 1), 2]}, Count[Map[Total[s #] &, Take[Tuples[{-1, 1}, Length@ s], -2^(n - 1)]], ?(Divisible[#, n] &)]], {n, 22}] (* _Michael De Vlieger, Mar 01 2018 *)

A054539 A000016 / 2.

Original entry on oeis.org

1, 1, 2, 3, 5, 8, 15, 26, 47, 86, 158, 293, 548, 1024, 1928, 3643, 6899, 13108, 24970, 47663, 91181, 174768, 335546, 645278, 1242767, 2396746, 4628198, 8947868, 17318417, 33554432, 65075294, 126322568, 245426708
Offset: 3

Views

Author

N. J. A. Sloane, Apr 10 2000

Keywords

Crossrefs

A063776(n) / 4, n>2.

A334125 Number of subsets of {1, 3, ..., 2*n-1} which sum to 0 modulo 2*n-1.

Original entry on oeis.org

2, 2, 2, 2, 4, 6, 10, 18, 30, 54, 98, 178, 328, 608, 1130, 2114, 3974, 7490, 14170, 26890, 51150, 97542, 186420, 356962, 684784, 1315870, 2532410, 4880646, 9418806, 18199014, 35204650, 68174116, 132152842, 256415958, 497967282, 967879954, 1882725390, 3665038872
Offset: 1

Views

Author

Jinyuan Wang, Apr 30 2020

Keywords

Examples

			a(5) = 4 because there are 4 subsets of {1, 3, 5, 7, 9} which sum to 0 modulo 9: {}, {9}, {1, 3, 5}, {1, 3, 5, 9}.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local V, k;
      V:= Vector(2*n-1);
      V[2*n-1]:= 1;
      for k from 1 to 2*n-1 by 2 do
        V:= V + V[[$(k+1)..(2*n-1),$1..k]]
      od;
      V[2*n-1]
    end proc:
    map(f, [$1..40]); # Robert Israel, May 12 2020
  • PARI
    a(n) = {my(v=Vec(prod(i=1, n, x^(2*i-1)+1))); sum(i=0, n^2\(2*n-1), v[n^2+1-i*(2*n-1)]); }

Formula

If 2*k - 1 is a prime, then a(k) = (2^k - 2*(-1)^floor(k/2))/(2*k - 1).
Conjecture: a(n) = 2*abs(A178738(n)).

A369878 Array read by antidiagonals: T(n,k) is the number of length n necklaces using at most k colors in which the convex hull of a set of beads of any color A cannot be transformed by rotation into the convex hull of a set of beads of any other color B (n >= 1, k >= 1).

Original entry on oeis.org

1, 2, 1, 3, 2, 1, 4, 3, 4, 1, 5, 4, 9, 4, 1, 6, 5, 16, 9, 8, 1, 7, 6, 25, 16, 27, 12, 1, 8, 7, 36, 25, 64, 93, 20, 1, 9, 8, 49, 36, 125, 304, 243, 32, 1, 10, 9, 64, 49, 216, 705, 928, 699, 60, 1, 11, 10, 81, 64, 343, 1356, 2405, 4384, 2019, 104, 1
Offset: 1

Views

Author

Maxim Karimov and Vladislav Sulima, Feb 03 2024

Keywords

Comments

It is assumed that all beads lie on a circle and that the distance between any two adjacent beads is the same.

Examples

			n\k| 1  2    3     4     5      6      7      8       9 ...
---+---------------------------------------------------
 1 | 1  2    3     4     5      6      7      8       9 ... A000027
 2 | 1  2    3     4     5      6      7      8       9 ... A000027
 3 | 1  4    9    16    25     36     49     64      81 ... A000290
 4 | 1  4    9    16    25     36     49     64      81 ... A000290
 5 | 1  8   27    64   125    216    343    512     729 ... A000578
 6 | 1 12   93   304   705   1356   2317   3648    5409
 7 | 1 20  243   928  2405   5076   9415  15968   25353
 8 | 1 32  699  4384 15245  39216  84007 159104  275769
 9 | 1 60 2019 18256 72765 202236 457135 902784 1620441
...
		

Crossrefs

Formula

T(n,2) = A063776(n).
Previous Showing 11-20 of 20 results.