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.

Showing 1-10 of 22 results. Next

A051293 Number of nonempty subsets of {1,2,3,...,n} whose elements have an integer average.

Original entry on oeis.org

1, 2, 5, 8, 15, 26, 45, 76, 135, 238, 425, 768, 1399, 2570, 4761, 8856, 16567, 31138, 58733, 111164, 211043, 401694, 766417, 1465488, 2807671, 5388782, 10359849, 19946832, 38459623, 74251094, 143524761, 277742488, 538043663, 1043333934, 2025040765, 3933915348
Offset: 1

Views

Author

John W. Layman, Oct 30 1999

Keywords

Comments

a(n) is asymptotic to 2^(n+1)/n. More precisely, I conjecture for any m > 0, a(n) = 2^(n+1)/n * Sum_{k=0..m} A000670(k)/n^k + o(1/n^(m+1)) (A000670 = preferential arrangements of n labeled elements) which can be written a(n) = 2^n/n * 2 + Sum_{k=1..m} A000629(k)/n^k + o(1/n^(m+1)) (A000629 = necklaces of sets of labeled beads). In fact I conjecture that a(n) = 2^(n+1)/n * (1 + 1/n + 3/n^2 + 13/n^3 + 75/n^4 + 541/n^5 + o(1/n^5)). - Benoit Cloitre, Oct 20 2002
A082550(n) = a(n+1) - a(n). - Reinhard Zumkeller, Feb 19 2006

Examples

			a(4) = 8 because each of the 8 subsets {1}, {2}, {3}, {4}, {1,3}, {2,4}, {1,2,3}, {2,3,4} has an integer average.
		

Crossrefs

Row sums of A061865 and A327481.

Programs

  • Maple
    with(numtheory):
    b:= n-> add(2^(n/d)*phi(d), d=select(x-> x::odd, divisors(n)))/n:
    a:= proc(n) option remember; `if`(n<1, 0, b(n)-1+a(n-1)) end:
    seq(a(n), n=1..40);  # Alois P. Heinz, Jul 15 2019
  • Mathematica
    Table[ Sum[a = Select[Divisors[i], OddQ[ # ] & ]; Apply[Plus, 2^(i/a)*EulerPhi[a]]/i, {i, n}] - n, {n, 34}]
    Table[Count[Subsets[Range[n]],?(IntegerQ[Mean[#]]&)],{n,35}] (* _Harvey P. Dale, Apr 14 2018 *)
  • PARI
    a(n)=sum(k=1,n,sumdiv(k,d,d%2*2^(k/d)*eulerphi(d))/k-1)
    
  • Python
    from sympy import totient, divisors
    def A051293(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))-n # Chai Wah Wu, Feb 22 2023

Formula

a(n) = Sum_{i=1..n} (A063776(i) - 1).

Extensions

Extended by Robert G. Wilson v, Oct 16 2002

A307683 Number of partitions of n having a non-integer median.

Original entry on oeis.org

0, 0, 1, 0, 2, 1, 4, 1, 7, 5, 11, 8, 18, 17, 31, 28, 47, 51, 75, 81, 119, 134, 181, 206, 277, 323, 420, 488, 623, 737, 922, 1084, 1352, 1597, 1960, 2313, 2819, 3330, 4029, 4743, 5704, 6722, 8030, 9434, 11234, 13175, 15601, 18262, 21552, 25184, 29612, 34518
Offset: 1

Views

Author

Clark Kimberling, Apr 24 2019

Keywords

Comments

This sequence and A325347 partition the partition numbers, A000041.
The median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length). - Gus Wiseman, Mar 16 2023

Examples

			a(7) counts these 4 partitions: [6,1], [5,2], [4,3], [3,2,1,1].
		

Crossrefs

The complement is counted by A325347, strict A359907.
For mean instead of median we have A349156, strict A361391.
These partitions have ranks A359912, complement A359908.
The strict case is A360952.
A000041 counts integer partitions, strict A000009.
A008284/A058398/A327482 count partitions by mean.
A359893/A359901/A359902 count partitions by median.

Programs

  • Mathematica
    Table[Count[IntegerPartitions[n], q_ /; !IntegerQ[Median[q]]], {n, 10}]

A359907 Number of strict integer partitions of n with integer median.

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 4, 2, 6, 4, 9, 6, 14, 10, 18, 16, 27, 23, 36, 34, 51, 49, 67, 68, 94, 95, 122, 129, 166, 174, 217, 233, 287, 308, 371, 405, 487, 528, 622, 683, 805, 880, 1024, 1127, 1305, 1435, 1648, 1818, 2086, 2295, 2611, 2882, 3273, 3606, 4076, 4496, 5069
Offset: 0

Views

Author

Gus Wiseman, Jan 21 2023

Keywords

Comments

The median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length).

Examples

			The a(1) = 1 through a(14) = 18 partitions (A..E = 10..14):
  1  2  3  4   5  6    7    8    9    A    B    C     D     E
           31     42   421  53   432  64   542  75    643   86
                  51        62   531  73   632  84    652   95
                  321       71   621  82   641  93    742   A4
                            431       91   731  A2    751   B3
                            521       532  821  B1    832   C2
                                      541       543   841   D1
                                      631       642   931   653
                                      721       651   A21   743
                                                732   6421  752
                                                741         761
                                                831         842
                                                921         851
                                                5421        932
                                                            941
                                                            A31
                                                            B21
                                                            7421
		

Crossrefs

For mean instead of median: A102627, non-strict A067538 (ranked by A316413).
This is the strict case of A325347, ranked by A359908.
The median statistic is ranked by A360005(n)/2.
A000041 counts partitions, strict A000009.
A051293 counts subsets with integer mean, median A000975, cf. A005578.
A058398 counts partitions by mean, see also A008284, A327482.
A326567/A326568 gives the mean of prime indices.
A359893, A359901, A359902 count partitions by median.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&IntegerQ[Median[#]]&]],{n,0,30}]

A000016 a(n) is the number of distinct (infinite) output sequences from binary n-stage shift register which feeds back the complement of the last stage.

Original entry on oeis.org

1, 1, 1, 2, 2, 4, 6, 10, 16, 30, 52, 94, 172, 316, 586, 1096, 2048, 3856, 7286, 13798, 26216, 49940, 95326, 182362, 349536, 671092, 1290556, 2485534, 4793492, 9256396, 17895736, 34636834, 67108864, 130150588, 252645136, 490853416
Offset: 0

Views

Author

Keywords

Comments

Also a(n+1) = number of distinct (infinite) output sequences from binary n-stage shift register which feeds back the complement of the sum of its contents. E.g., for n=5 there are 6 such sequences.
Also a(n+1) = number of binary vectors (x_1,...x_n) satisfying Sum_{i=1..n} i*x_i = 0 (mod n+1) = size of Varshamov-Tenengolts code VT_0(n). E.g., |VT_0(5)| = 6 = a(6).
Number of binary necklaces with an odd number of zeros. - Joerg Arndt, Oct 26 2015
Also, number of subsets of {1,2,...,n-1} which sum to 0 modulo n (cf. A063776). - Max Alekseyev, Mar 26 2016
From Gus Wiseman, Sep 14 2019: (Start)
Also the number of subsets of {1..n} containing n whose mean is an element. For example, the a(1) = 1 through a(8) = 16 subsets are:
1 2 3 4 5 6 7 8
123 234 135 246 147 258
345 456 357 468
12345 1236 567 678
1456 2347 1348
23456 2567 1568
12467 3458
13457 3678
34567 12458
1234567 14578
23578
24568
45678
123468
135678
2345678
(End)
Number of self-dual binary necklaces with 2n beads (cf. A263768, A007147). - Bernd Mulansky, Apr 25 2023

Examples

			For n=3 the 2 output sequences are 000111000111... and 010101...
For n=5 the 4 output sequences are those with periodic parts {0000011111, 0001011101, 0010011011, 01}.
For n=6 there are 6 such sequences.
		

References

  • B. D. Ginsburg, On a number theory function applicable in coding theory, Problemy Kibernetiki, No. 19 (1967), pp. 249-252.
  • S. W. Golomb, Shift-Register Sequences, Holden-Day, San Francisco, 1967, p. 172.
  • J. Hedetniemi and K. R. Hutson, Equilibrium of shortest path load in ring network, Congressus Numerant., 203 (2010), 75-95. See p. 83.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane, On single-deletion-correcting codes, in Codes and Designs (Columbus, OH, 2000), 273-291, Ohio State Univ. Math. Res. Inst. Publ., 10, de Gruyter, Berlin, 2002.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • D. Stoffer, Delay equations with rapidly oscillating stable periodic solutions, J. Dyn. Diff. Eqs. 20 (1) (2008) 201, eq. (39)

Crossrefs

The main diagonal of table A068009, the left edge of triangle A053633.
Subsets whose mean is an element are A065795.
Dominated by A082550.
Partitions containing their mean are A237984.
Subsets containing n but not their mean are A327477.

Programs

  • Haskell
    a000016 0 = 1
    a000016 n = (`div` (2 * n)) $ sum $
       zipWith (*) (map a000010 oddDivs) (map ((2 ^) . (div n)) $ oddDivs)
       where oddDivs = a182469_row n
    -- Reinhard Zumkeller, May 01 2012
    
  • Maple
    A000016 := proc(n) local d, t; if n = 0 then return 1 else t := 0; for d from 1 to n do if n mod d = 0 and d mod 2 = 1 then t := t + NumberTheory:-Totient(d)* 2^(n/d)/(2*n) fi od; return t fi end:
  • Mathematica
    a[0] = 1; a[n_] := Sum[Mod[k, 2] EulerPhi[k]*2^(n/k)/(2*n), {k, Divisors[n]}]; Table[a[n], {n, 0, 35}](* Jean-François Alcover, Feb 17 2012, after Pari *)
  • PARI
    a(n)=if(n<1,n >= 0,sumdiv(n,k,(k%2)*eulerphi(k)*2^(n/k))/(2*n));
    
  • Python
    from sympy import totient, divisors
    def A000016(n): return sum(totient(d)<>(~n&n-1).bit_length(),generator=True))//n if n else 1 # Chai Wah Wu, Feb 21 2023

Formula

a(n) = Sum_{odd d divides n} (phi(d)*2^(n/d))/(2*n), n>0.
a(n) = A063776(n)/2.
a(n) = 2^(n-1) - A327477(n). - Gus Wiseman, Sep 14 2019

Extensions

More terms from Michael Somos, Dec 11 1999

A327475 Number of subsets of {1..n} whose mean is an integer, where {} has mean 0.

Original entry on oeis.org

1, 2, 3, 6, 9, 16, 27, 46, 77, 136, 239, 426, 769, 1400, 2571, 4762, 8857, 16568, 31139, 58734, 111165, 211044, 401695, 766418, 1465489, 2807672, 5388783, 10359850, 19946833, 38459624, 74251095, 143524762, 277742489, 538043664, 1043333935, 2025040766, 3933915349
Offset: 0

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Examples

			The a(0) = 1 through a(5) = 16 subsets:
  {}  {}   {}   {}       {}       {}
      {1}  {1}  {1}      {1}      {1}
           {2}  {2}      {2}      {2}
                {3}      {3}      {3}
                {1,3}    {4}      {4}
                {1,2,3}  {1,3}    {5}
                         {2,4}    {1,3}
                         {1,2,3}  {1,5}
                         {2,3,4}  {2,4}
                                  {3,5}
                                  {1,2,3}
                                  {1,3,5}
                                  {2,3,4}
                                  {3,4,5}
                                  {1,2,4,5}
                                  {1,2,3,4,5}
		

Crossrefs

If the subset is required to contain n, we get A063776.

Programs

  • Maple
    with(numtheory):
    b:= n-> add(2^(n/d)*phi(d), d=select(x-> x::odd, divisors(n)))/n:
    a:= proc(n) option remember; `if`(n=0, 1, b(n)-1+a(n-1)) end:
    seq(a(n), n=0..36);  # Alois P. Heinz, Jan 13 2024
  • Mathematica
    Table[Length[Select[Subsets[Range[n]],#=={}||IntegerQ[Mean[#]]&]],{n,0,10}]
  • Python
    from sympy import totient, divisors
    def A327475(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))-n+1 # Chai Wah Wu, Feb 22 2023

Formula

a(n) = A051293(n) + 1.

A360068 Number of integer partitions of n such that the parts have the same mean as the multiplicities.

Original entry on oeis.org

1, 1, 0, 0, 1, 0, 0, 0, 2, 1, 0, 0, 6, 0, 0, 0, 6, 0, 7, 0, 1, 0, 0, 0, 0, 90, 0, 63, 0, 0, 0, 0, 11, 0, 0, 0, 436, 0, 0, 0, 0, 0, 0, 0, 0, 2157, 0, 0, 240, 1595, 22, 0, 0, 0, 6464, 0, 0, 0, 0, 0, 0, 0, 0, 11628, 4361, 0, 0, 0, 0, 0, 0, 0, 12927, 0, 0, 621, 0
Offset: 0

Views

Author

Gus Wiseman, Jan 27 2023

Keywords

Comments

Note that such a partition cannot be strict for n > 1.
Conjecture: If n is squarefree, then a(n) = 0.

Examples

			The n = 1, 4, 8, 9, 12, 16, 18 partitions (D=13):
  (1)  (22)  (3311)  (333)  (322221)  (4444)      (444222)
             (5111)         (332211)  (43222111)  (444411)
                            (422211)  (43321111)  (552222)
                            (522111)  (53221111)  (555111)
                            (531111)  (54211111)  (771111)
                            (621111)  (63211111)  (822222)
                                                  (D11111)
For example, the partition (4,3,3,3,3,3,2,2,1,1) has mean 5/2, and its multiplicities (1,5,2,2) also have mean 5/2, so it is counted under a(20).
		

Crossrefs

These partitions are ranked by A359903, for prime factors A359904.
Positions of positive terms are A360070.
A000041 counts partitions, strict A000009.
A058398 counts partitions by mean, see also A008284, A327482.
A088529/A088530 gives mean of prime signature (A124010).
A326567/A326568 gives mean of prime indices (A112798).
A360069 counts partitions whose multiplicities have integer mean.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],Mean[#]==Mean[Length/@Split[#]]&]],{n,0,30}]

A063776 Number of subsets of {1,2,...,n} which sum to 0 modulo n.

Original entry on oeis.org

2, 2, 4, 4, 8, 12, 20, 32, 60, 104, 188, 344, 632, 1172, 2192, 4096, 7712, 14572, 27596, 52432, 99880, 190652, 364724, 699072, 1342184, 2581112, 4971068, 9586984, 18512792, 35791472, 69273668, 134217728, 260301176, 505290272, 981706832
Offset: 1

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), Aug 16 2001

Keywords

Comments

From Gus Wiseman, Sep 14 2019: (Start)
Also the number of subsets of {1..n} that are empty or contain n and have integer mean. If the subsets are not required to contain n, we get A327475. For example, the a(1) = 2 through a(6) = 12 subsets are:
{} {} {} {} {} {}
{1} {2} {3} {4} {5} {6}
{1,3} {2,4} {1,5} {2,6}
{1,2,3} {2,3,4} {3,5} {4,6}
{1,3,5} {1,2,6}
{3,4,5} {1,5,6}
{1,2,4,5} {2,4,6}
{1,2,3,4,5} {4,5,6}
{1,2,3,6}
{1,4,5,6}
{2,3,5,6}
{2,3,4,5,6}
(End)

Examples

			G.f. = 2*x + 2*x^2 + 4*x^3 + 4*x^4 + 8*x^5 + 12*x^6 + 20*x^7 + 32*x^8 + 60*x^9 + ...
		

Crossrefs

Programs

  • Haskell
    a063776 n = a053636 n `div` n  -- Reinhard Zumkeller, Sep 13 2013
    
  • Mathematica
    Table[a = Select[ Divisors[n], OddQ[ # ] &]; Apply[Plus, 2^(n/a)*EulerPhi[a]]/n, {n, 1, 35}]
    a[ n_] := If[ n < 1, 0, 1/n Sum[ Mod[ d, 2] EulerPhi[ d] 2^(n / d), {d, Divisors[ n]}]]; (* Michael Somos, May 09 2013 *)
    Table[Length[Select[Subsets[Range[n]],#=={}||MemberQ[#,n]&&IntegerQ[Mean[#]]&]],{n,0,10}] (* Gus Wiseman, Sep 14 2019 *)
  • PARI
    {a(n) = if( n<1, 0, 1 / n * sumdiv( n, d, (d % 2) * eulerphi(d) * 2^(n / d)))}; /* Michael Somos, May 09 2013 */
    
  • PARI
    a(n) = sumdiv(n, d, (d%2)* 2^(n/d)*eulerphi(d))/n; \\ Michel Marcus, Feb 10 2016
    
  • Python
    from sympy import totient, divisors
    def A063776(n): return (sum(totient(d)<>(~n&n-1).bit_length(),generator=True))<<1)//n # Chai Wah Wu, Feb 21 2023

Formula

a(n) = (1/n) * Sum_{d divides n and d is odd} 2^(n/d) * phi(d).
a(n) = (1/n) * A053636(n). - Michael Somos, May 09 2013
a(n) = 2 * A000016(n).
For odd n, a(n) = A000031(n).
G.f.: -Sum_{m >= 0} (phi(2*m + 1)/(2*m + 1)) * log(1 - 2*x^(2*m + 1)). - Petros Hadjicostas, Jul 13 2019
a(n) = A082550(n) + 1. - Gus Wiseman, Sep 14 2019

Extensions

More terms from Vladeta Jovovic, Aug 20 2001

A359897 Number of strict integer partitions of n whose parts have the same mean as median.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 4, 4, 4, 7, 6, 6, 10, 7, 10, 13, 11, 9, 20, 10, 20, 18, 21, 12, 30, 24, 28, 27, 30, 15, 73, 16, 37, 43, 45, 67, 74, 19, 55, 71, 126, 21, 150, 22, 75, 225, 78, 24, 183, 126, 245, 192, 132, 27, 284, 244, 403, 303, 120, 30, 828
Offset: 0

Views

Author

Gus Wiseman, Jan 20 2023

Keywords

Examples

			The a(1) = 1 through a(9) = 7 partitions:
  (1)  (2)  (3)    (4)    (5)    (6)      (7)    (8)    (9)
            (2,1)  (3,1)  (3,2)  (4,2)    (4,3)  (5,3)  (5,4)
                          (4,1)  (5,1)    (5,2)  (6,2)  (6,3)
                                 (3,2,1)  (6,1)  (7,1)  (7,2)
                                                        (8,1)
                                                        (4,3,2)
                                                        (5,3,1)
		

Crossrefs

The non-strict version is A240219, complement A359894, ranked by A359889.
The complement is counted by A359898.
The odd-length case is A359899, complement A359900.
A000041 counts partitions, strict A000009.
A008284/A058398/A327482 count partitions by mean, ranked by A326567/A326568.
A008289 counts strict partitions by mean.
A237984 counts partitions containing their mean, complement A327472.
A240850 counts strict partitions containing their mean, complement A240851.
A325347 counts ptns with integer median, strict A359907, ranked by A359908.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],UnsameQ@@#&&Mean[#]==Median[#]&]],{n,0,30}]

A360241 Number of integer partitions of n whose distinct parts have integer mean.

Original entry on oeis.org

0, 1, 2, 2, 4, 3, 8, 6, 13, 13, 22, 19, 43, 34, 56, 66, 97, 92, 156, 143, 233, 256, 322, 341, 555, 542, 710, 831, 1098, 1131, 1644, 1660, 2275, 2484, 3035, 3492, 4731, 4848, 6063, 6893, 8943, 9378, 12222, 13025, 16520, 18748, 22048, 24405, 31446, 33698, 41558
Offset: 0

Views

Author

Gus Wiseman, Feb 02 2023

Keywords

Examples

			The a(1) = 1 through a(8) = 13 partitions:
  (1)  (2)   (3)    (4)     (5)      (6)       (7)        (8)
       (11)  (111)  (22)    (311)    (33)      (331)      (44)
                    (31)    (11111)  (42)      (511)      (53)
                    (1111)           (51)      (3211)     (62)
                                     (222)     (31111)    (71)
                                     (321)     (1111111)  (422)
                                     (3111)               (2222)
                                     (111111)             (3221)
                                                          (3311)
                                                          (5111)
                                                          (32111)
                                                          (311111)
                                                          (11111111)
For example, the partition (32111) has distinct parts {1,2,3} with mean 2, so is counted under a(8).
		

Crossrefs

For parts instead of distinct parts we have A067538, ranked by A316413.
The strict case is A102627.
These partitions are ranked by A326621.
For multiplicities instead of distinct parts: A360069, ranked by A067340.
A000041 counts integer partitions, strict A000009.
A008284 counts partitions by number of parts.
A051293 counts subsets with integer mean, median A000975.
A058398 counts partitions by mean, also A327482.
A116608 counts partitions by number of distinct parts.
A326619/A326620 gives mean of distinct prime indices.
A326622 counts factorizations with integer mean, strict A328966.
A360071 counts partitions by number of parts and number of distinct parts.
The following count partitions:
- A360242 mean(parts) != mean(distinct parts), ranked by A360246.
- A360243 mean(parts) = mean(distinct parts), ranked by A360247.
- A360250 mean(parts) > mean(distinct parts), ranked by A360252.
- A360251 mean(parts) < mean(distinct parts), ranked by A360253.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],IntegerQ[Mean[Union[#]]]&]],{n,0,30}]

A359906 Number of integer partitions of n with integer mean and integer median.

Original entry on oeis.org

1, 2, 2, 4, 2, 8, 2, 10, 9, 14, 2, 39, 2, 24, 51, 49, 2, 109, 2, 170, 144, 69, 2, 455, 194, 116, 381, 668, 2, 1378, 2, 985, 956, 316, 2043, 4328, 2, 511, 2293, 6656, 2, 8634, 2, 8062, 14671, 1280, 2, 26228, 8035, 15991, 11614, 25055, 2, 47201, 39810, 65092
Offset: 1

Views

Author

Gus Wiseman, Jan 21 2023

Keywords

Comments

The median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length).

Examples

			The a(1) = 1 through a(9) = 9 partitions:
  1  2   3    4     5      6       7        8         9
     11  111  22    11111  33      1111111  44        333
              31           42               53        432
              1111         51               62        441
                           222              71        522
                           321              2222      531
                           411              3221      621
                           111111           3311      711
                                            5111      111111111
                                            11111111
		

Crossrefs

For just integer mean we have A067538, strict A102627, ranked by A316413.
For just integer median we have A325347, strict A359907, ranked by A359908.
These partitions are ranked by A360009.
A000041 counts partitions, strict A000009.
A058398 counts partitions by mean, see also A008284, A327482.
A051293 counts subsets with integer mean, median A000975.
A326567/A326568 gives mean of prime indices.
A326622 counts factorizations with integer mean, strict A328966.
A359893/A359901/A359902 count partitions by median.
A360005(n)/2 gives median of prime indices.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], IntegerQ[Mean[#]]&&IntegerQ[Median[#]]&]],{n,1,30}]
Showing 1-10 of 22 results. Next