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 12 results. Next

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.

A327481 Triangle read by rows where T(n,k) is the number of nonempty subsets of {1..n} with mean k.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 3, 3, 1, 1, 3, 7, 3, 1, 1, 3, 9, 9, 3, 1, 1, 3, 9, 19, 9, 3, 1, 1, 3, 9, 25, 25, 9, 3, 1, 1, 3, 9, 29, 51, 29, 9, 3, 1, 1, 3, 9, 31, 75, 75, 31, 9, 3, 1, 1, 3, 9, 31, 93, 151, 93, 31, 9, 3, 1, 1, 3, 9, 31, 105, 235, 235, 105, 31, 9, 3, 1
Offset: 1

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Comments

All terms are odd.

Examples

			Triangle begins:
                         1
                       1   1
                     1   3   1
                   1   3   3   1
                 1   3   7   3   1
               1   3   9   9   3   1
             1   3   9  19   9   3   1
           1   3   9  25  25   9   3   1
         1   3   9  29  51  29   9   3   1
       1   3   9  31  75  75  31   9   3   1
     1   3   9  31  93 151  93  31   9   3   1
   1   3   9  31 105 235 235 105  31   9   3   1
The subsets counted in row n = 5:
  {1}  {2}      {3}          {4}      {5}
       {1,3}    {1,5}        {3,5}
       {1,2,3}  {2,4}        {3,4,5}
                {1,3,5}
                {2,3,4}
                {1,2,4,5}
                {1,2,3,4,5}
		

Crossrefs

Row sums are A051293.
The sequence of rows converges to A066571.
The version for partitions is A327482.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],Mean[#]==k&]],{n,10},{k,n}]

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}]

A065795 Number of subsets of {1,2,...,n} that contain the average of their elements.

Original entry on oeis.org

1, 2, 4, 6, 10, 16, 26, 42, 72, 124, 218, 390, 706, 1292, 2388, 4436, 8292, 15578, 29376, 55592, 105532, 200858, 383220, 732756, 1403848, 2694404, 5179938, 9973430, 19229826, 37125562, 71762396, 138871260, 269021848, 521666984, 1012520400, 1966957692, 3824240848
Offset: 1

Views

Author

John W. Layman, Dec 05 2001

Keywords

Comments

Also the number of subsets of {1,2,...,n} with sum of entries divisible by the largest element (compare A000016). See the Palmer Melbane link for a bijection. - Joel B. Lewis, Nov 13 2014

Examples

			a(4)=6, since {1}, {2}, {3}, {4}, {1,2,3} and {2,3,4} contain their averages.
From _Gus Wiseman_, Sep 14 2019: (Start)
The a(1) = 1 through a(6) = 16 subsets:
  {1}  {1}  {1}      {1}      {1}          {1}
       {2}  {2}      {2}      {2}          {2}
            {3}      {3}      {3}          {3}
            {1,2,3}  {4}      {4}          {4}
                     {1,2,3}  {5}          {5}
                     {2,3,4}  {1,2,3}      {6}
                              {1,3,5}      {1,2,3}
                              {2,3,4}      {1,3,5}
                              {3,4,5}      {2,3,4}
                              {1,2,3,4,5}  {2,4,6}
                                           {3,4,5}
                                           {4,5,6}
                                           {1,2,3,6}
                                           {1,4,5,6}
                                           {1,2,3,4,5}
                                           {2,3,4,5,6}
(End)
		

Crossrefs

Subsets containing n whose mean is an element are A000016.
The version for integer partitions is A237984.
Subsets not containing their mean are A327471.

Programs

  • Mathematica
    Table[ Sum[a = Select[Divisors[i], OddQ[ # ] &]; Apply[ Plus, 2^(i/a) * EulerPhi[a]]/i, {i, n}]/2, {n, 34}]
    (* second program *)
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,Mean[#]]&]],{n,0,10}] (* Gus Wiseman, Sep 14 2019 *)
  • PARI
    a(n) = (1/2)*sum(i=1, n, (1/i)*sumdiv(i, d, if (d%2, 2^(i/d)*eulerphi(d)))); \\ Michel Marcus, Dec 20 2020
    
  • Python
    from sympy import totient, divisors
    def A065795(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))>>1 # Chai Wah Wu, Feb 22 2023

Formula

a(n) = (1/2)*Sum_{i=1..n} (f(i) - 1) where f(i) = (1/i) * Sum_{d | i and d is odd} 2^(i/d) * phi(d).
a(n) = (n + A051293(n))/2.
a(n) = 2^n - A327471(n). - Gus Wiseman, Sep 14 2019

Extensions

Edited and extended by Robert G. Wilson v, Nov 15 2002

A359898 Number of strict integer partitions of n whose parts do not have the same mean as median.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 4, 6, 5, 11, 12, 14, 21, 29, 26, 44, 44, 58, 68, 92, 92, 118, 137, 165, 192, 241, 223, 324, 353, 405, 467, 518, 594, 741, 809, 911, 987, 1239, 1276, 1588, 1741, 1823, 2226, 2566, 2727, 3138, 3413, 3905, 4450, 5093, 5434, 6134
Offset: 0

Views

Author

Gus Wiseman, Jan 20 2023

Keywords

Examples

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

Crossrefs

The non-strict version is ranked by A359890, complement A359889.
The non-strict version is A359894, complement A240219.
The complement is counted by A359897.
The odd-length case is A359900, complement A359899.
A000041 counts partitions, strict A000009.
A008284/A058398/A327482 count partitions by mean, ranked by A326567/A326568.
A008289 counts strict partitions by mean.
A067538 counts ptns with integer mean, strict A102627, ranked by A316413.
A237984 counts ptns containing their mean, strict A240850, ranked by A327473.
A325347 counts ptns with integer median, strict A359907, ranked by A359908.
A359893 and A359901 count partitions by median, odd-length A359902.

Programs

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

A327471 Number of subsets of {1..n} not containing their mean.

Original entry on oeis.org

1, 1, 2, 4, 10, 22, 48, 102, 214, 440, 900, 1830, 3706, 7486, 15092, 30380, 61100, 122780, 246566, 494912, 992984, 1991620, 3993446, 8005388, 16044460, 32150584, 64414460, 129037790, 258462026, 517641086, 1036616262, 2075721252, 4156096036, 8320912744, 16658202200
Offset: 0

Views

Author

Gus Wiseman, Sep 12 2019

Keywords

Examples

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

Crossrefs

Subsets containing their mean are A065795.
Subsets containing n but not their mean are A327477.
Partitions not containing their mean are A327472.
Strict partitions not containing their mean are A240851.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],!MemberQ[#,Mean[#]]&]],{n,0,10}]
  • Python
    from sympy import totient, divisors
    def A327471(n): return (1<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))>>1) # Chai Wah Wu, Feb 22 2023

Formula

a(n) = 2^n - A065795(n). - Alois P. Heinz, Sep 13 2019

Extensions

More terms from Alois P. Heinz, Sep 13 2019

A327474 Number of distinct means of subsets of {1..n}, where {} has mean 0.

Original entry on oeis.org

1, 2, 4, 6, 10, 16, 26, 38, 56, 78, 106, 138, 180, 226, 284, 348, 420, 500, 596, 698, 818, 946, 1086, 1236, 1408, 1588, 1788, 2000, 2230, 2472, 2742, 3020, 3328, 3652, 3996, 4356, 4740, 5136, 5568, 6018, 6492, 6982, 7512, 8054, 8638, 9242, 9870, 10520, 11216
Offset: 0

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Examples

			The a(3) = 6 distinct means are 0, 1, 3/2, 2, 5/2, 3.
		

Crossrefs

The version for only nonempty subsets is A135342.

Programs

  • Maple
    a:= proc(n) option remember; `if`(n<4, [1, 2, 4, 6][n+1],
          2*a(n-1)-a(n-2)+numtheory[phi](n-1))
        end:
    seq(a(n), n=0..50);  # Alois P. Heinz, Feb 22 2023
  • Mathematica
    Table[Length[Union[Mean/@Subsets[Range[n]]]],{n,0,10}]
  • Python
    from itertools import count, islice
    from sympy import totient
    def A327474_gen(): # generator of terms
        a, b = 4, 6
        yield from (1,2,4,6)
        for n in count(3):
            a, b = b, (b<<1)-a+totient(n)
            yield b
    A327474_list = list(islice(A327474_gen(),30)) # Chai Wah Wu, Feb 22 2023

Formula

a(n) = A135342(n) + 1.
a(n) = 2*a(n-1) - a(n-2) + phi(n-1) for n>3. - Chai Wah Wu, Feb 22 2023

A327477 Number of subsets of {1..n} containing n whose mean is not an element.

Original entry on oeis.org

0, 0, 1, 2, 6, 12, 26, 54, 112, 226, 460, 930, 1876, 3780, 7606, 15288, 30720, 61680, 123786, 248346, 498072, 998636, 2001826, 4011942, 8039072, 16106124, 32263876, 64623330, 129424236, 259179060, 518975176, 1039104990, 2080374784, 4164816708, 8337289456
Offset: 0

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Examples

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

Crossrefs

Subsets whose mean is an element are A065795.
Subsets whose mean is not an element are A327471.
Subsets containing n whose mean is an element are A000016.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],MemberQ[#,n]&&!MemberQ[#,Mean[#]]&]],{n,0,10}]
  • Python
    from sympy import totient, divisors
    def A327477(n): return (1<>(~n&n-1).bit_length(),generator=True))//n if n else 0 # Chai Wah Wu, Feb 21 2023

Formula

From Alois P. Heinz, Feb 21 2023: (Start)
a(n) = A327471(n) - A327471(n-1) for n>=1.
a(n) = 2^(n-1) - A000016(n) for n>=1. (End)

Extensions

a(25)-a(34) from Alois P. Heinz, Feb 21 2023

A327484 Number of integer partitions of 2^n whose mean is a power of 2.

Original entry on oeis.org

1, 2, 4, 11, 66, 1417, 178803, 275379307, 15254411521973, 108800468645440803267, 964567296140908420613296779144, 219614169629364529542990295052656098001967511, 38626966436500261962963100479469496821891576834974275502742922521
Offset: 0

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Comments

Number of partitions of 2^n whose number of parts is a power of 2. - Chai Wah Wu, Sep 21 2023

Examples

			The a(0) = 1 through a(3) = 11 partitions:
  (1)  (2)   (4)     (8)
       (11)  (22)    (44)
             (31)    (53)
             (1111)  (62)
                     (71)
                     (2222)
                     (3221)
                     (3311)
                     (4211)
                     (5111)
                     (11111111)
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[2^n],IntegerQ[Mean[#]]&]],{n,0,5}]
  • Python
    from sympy.utilities.iterables import partitions
    def A327484(n): return sum(1 for s,p in partitions(1<Chai Wah Wu, Sep 21 2023
    
  • Python
    # uses A008284_T
    def A327484(n): return sum(A008284_T(1<Chai Wah Wu, Sep 21 2023

Extensions

a(7) from Chai Wah Wu, Sep 14 2019
a(8)-a(11) from Alois P. Heinz, Sep 21 2023
a(12) from Chai Wah Wu, Sep 21 2023
Showing 1-10 of 12 results. Next