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-6 of 6 results.

A318748 Number of integer compositions of n that have only one part or whose consecutive parts are coprime and the last and first part are also coprime.

Original entry on oeis.org

1, 1, 2, 4, 7, 13, 24, 43, 82, 151, 285, 535, 1005, 1883, 3533, 6631, 12460, 23407, 43952, 82538, 154999, 291088, 546674, 1026687, 1928118, 3621017, 6800300, 12771086, 23984329, 45042959, 84591339, 158863807, 298348613, 560303342, 1052258402, 1976157510
Offset: 0

Views

Author

Gus Wiseman, Sep 02 2018

Keywords

Examples

			The a(5) = 13 compositions with adjacent parts coprime:
  (5)
  (41) (14) (32) (23)
  (311) (131) (113)
  (2111) (1211) (1121) (1112)
  (11111)
Missing from this list are (221), (212), and (122).
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Or[Length[#]==1,And@@CoprimeQ@@@Partition[#,2,1,1]]&]],{n,20}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q, ]}
    seq(n)={concat([1], vector(n, i, i > 1) + sum(k=1, n, b(n, k, (i, j)->gcd(i, j)==1)))} \\ Andrew Howroyd, Nov 01 2019

Formula

a(n) = A328609(n) + 1 for n > 1. - Andrew Howroyd, Nov 01 2019

Extensions

a(21)-a(35) from Alois P. Heinz, Sep 02 2018
Name corrected by Gus Wiseman, Nov 04 2019

A328609 Number of compositions of n whose circularly adjacent parts are relatively prime.

Original entry on oeis.org

1, 1, 1, 3, 6, 12, 23, 42, 81, 150, 284, 534, 1004, 1882, 3532, 6630, 12459, 23406, 43951, 82537, 154998, 291087, 546673, 1026686, 1928117, 3621016, 6800299, 12771085, 23984328, 45042958, 84591338, 158863806, 298348612, 560303341, 1052258401, 1976157509
Offset: 0

Views

Author

Gus Wiseman, Oct 26 2019

Keywords

Comments

Circularity means the last part is followed by the first.

Examples

			The a(1) = 1 through a(6) = 23 compositions:
  (1)  (11)  (12)   (13)    (14)     (15)
             (21)   (31)    (23)     (51)
             (111)  (112)   (32)     (114)
                    (121)   (41)     (123)
                    (211)   (113)    (132)
                    (1111)  (131)    (141)
                            (311)    (213)
                            (1112)   (231)
                            (1121)   (312)
                            (1211)   (321)
                            (2111)   (411)
                            (11111)  (1113)
                                     (1131)
                                     (1212)
                                     (1311)
                                     (2121)
                                     (3111)
                                     (11112)
                                     (11121)
                                     (11211)
                                     (12111)
                                     (21111)
                                     (111111)
		

Crossrefs

The necklace version is A328597 or A318728 (with singletons).
The aperiodic version is A328670.
The Lyndon word version is A318745.
The version with singletons is A318748.
The non-circular version is A167606.
Relatively prime compositions are A000740.
Compositions with no part circularly followed by a divisor are A328598.

Programs

  • Mathematica
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@CoprimeQ@@@Partition[#,2,1,1]&]],{n,10}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q, ]}
    seq(n)={concat([1], sum(k=1, n, b(n, k, (i, j)->gcd(i, j)==1)))} \\ Andrew Howroyd, Nov 01 2019

Formula

a(n > 1) = A318748(n) - 1.

A328597 Number of necklace compositions of n where every pair of adjacent parts (including the last with the first) is relatively prime.

Original entry on oeis.org

1, 1, 2, 3, 5, 8, 12, 21, 33, 57, 94, 167, 279, 491, 852, 1507, 2647, 4714, 8349, 14923, 26642, 47793, 85778, 154474, 278322, 502715, 908912, 1646205, 2984546, 5418652, 9847189, 17916000, 32625617, 59470539, 108493149, 198094482, 361965238, 661891579, 1211162270
Offset: 1

Views

Author

Gus Wiseman, Oct 23 2019

Keywords

Comments

A necklace composition of n is a finite sequence of positive integers summing to n that is lexicographically minimal among all of its cyclic rotations.

Examples

			The a(1) = 1 through a(7) = 12 necklace compositions:
  (1)  (1,1)  (1,2)    (1,3)      (1,4)        (1,5)          (1,6)
              (1,1,1)  (1,1,2)    (2,3)        (1,1,4)        (2,5)
                       (1,1,1,1)  (1,1,3)      (1,2,3)        (3,4)
                                  (1,1,1,2)    (1,3,2)        (1,1,5)
                                  (1,1,1,1,1)  (1,1,1,3)      (1,1,1,4)
                                               (1,2,1,2)      (1,1,2,3)
                                               (1,1,1,1,2)    (1,1,3,2)
                                               (1,1,1,1,1,1)  (1,2,1,3)
                                                              (1,1,1,1,3)
                                                              (1,1,2,1,2)
                                                              (1,1,1,1,1,2)
                                                              (1,1,1,1,1,1,1)
		

Crossrefs

The non-necklace version is A328609.
The non-necklace non-circular version is A167606.
The version with singletons is A318728.
The aperiodic case is A318745.
The indivisible (instead of coprime) version is A328600.
The non-coprime (instead of coprime) version is A328602.
Necklace compositions are A008965.

Programs

  • Mathematica
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],neckQ[#]&&And@@CoprimeQ@@@Partition[#,2,1,1]&]],{n,10}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q,]}
    seq(n)={my(v=sum(k=1, n, k*b(n, k, (i,j)->gcd(i,j)==1))); vector(n, n, sumdiv(n, d, eulerphi(d)*v[n/d])/n)} \\ Andrew Howroyd, Oct 26 2019

Formula

a(n > 1) = A318728(n) - 1.

Extensions

Terms a(21) and beyond from Andrew Howroyd, Oct 26 2019

A318746 Number of Lyndon compositions (aperiodic necklaces of positive integers) with sum n and successive parts (including the last with the first part) being indivisible.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 3, 2, 4, 5, 6, 8, 11, 17, 20, 29, 41, 56, 79, 107, 155, 214, 305, 422, 604, 850, 1207, 1709, 2424, 3439, 4905, 6972, 9949, 14171, 20268, 28915, 41392, 59176, 84790, 121428, 174163, 249760, 358578, 514873, 739910, 1063523, 1529767, 2200926
Offset: 1

Views

Author

Gus Wiseman, Sep 02 2018

Keywords

Examples

			The a(14) = 17 Lyndon compositions with successive parts indivisible:
  (14)
  (3,11) (4,10) (5,9) (6,8)
  (2,3,9) (2,5,7) (2,7,5) (3,4,7) (3,6,5) (3,7,4)
  (2,3,2,7) (2,3,4,5) (2,4,3,5) (2,4,5,3) (2,5,4,3)
  (2,3,2,4,3)
		

Crossrefs

Programs

  • Mathematica
    LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Or[Length[#]==1,LyndonQ[#]&&And@@Not/@Divisible@@@Partition[#,2,1,1]]&]],{n,20}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q, ]}
    seq(n)={my(v=sum(k=1, n, k*b(n, k, (i, j)->i%j<>0))); vector(n, n, 1 + sumdiv(n, d, moebius(d)*v[n/d])/n)} \\ Andrew Howroyd, Nov 01 2019

Extensions

Terms a(21) and beyond from Andrew Howroyd, Sep 08 2018

A318747 Number of Lyndon compositions (aperiodic necklaces of positive integers) with sum n and adjacent parts (including the last with the first part) being indivisible (either way).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 3, 2, 3, 5, 5, 8, 7, 12, 14, 20, 31, 37, 51, 64, 96, 129, 177, 246, 328, 465, 630, 889, 1230, 1692, 2370, 3250, 4587, 6354, 8895, 12384, 17252, 24180, 33777, 47336, 66254, 92752, 130142, 182337, 256246, 359500, 505231, 709787, 997951, 1403883
Offset: 1

Views

Author

Gus Wiseman, Sep 02 2018

Keywords

Examples

			The a(14) = 12 Lyndon compositions with adjacent parts indivisible either way:
  (14)
  (3,11) (4,10) (5,9) (6,8)
  (2,5,7) (2,7,5) (3,4,7) (3,7,4)
  (2,3,2,7) (2,3,4,5) (2,5,4,3)
		

Crossrefs

Programs

  • Mathematica
    LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Or[Length[#]==1,And[LyndonQ[#],And@@Not/@Divisible@@@Partition[#,2,1,1],And@@Not/@Divisible@@@Reverse/@Partition[#,2,1,1]]]&]],{n,20}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q, ]}
    seq(n)={my(v=sum(k=1, n, k*b(n, k, (i, j)->i%j<>0 && j%i<>0))); vector(n, n, 1 + sumdiv(n, d, moebius(d)*v[n/d])/n)} \\ Andrew Howroyd, Nov 01 2019

Extensions

Terms a(21) and beyond from Andrew Howroyd, Sep 08 2018

A328669 Number of Lyndon compositions of n where every pair of adjacent parts (including the last with the first) is relatively prime.

Original entry on oeis.org

1, 0, 1, 2, 4, 6, 11, 18, 31, 52, 93, 157, 278, 479, 846, 1486, 2646, 4675, 8348, 14864, 26629, 47699, 85777, 154289, 278317, 502436, 908879, 1645712, 2984545, 5417742, 9847188, 17914493, 32625522, 59467892, 108493133, 198089609, 361965237, 661883230, 1211161990
Offset: 1

Views

Author

Gus Wiseman, Oct 26 2019

Keywords

Comments

A Lyndon composition of n is a finite sequence of positive integers summing to n that is lexicographically strictly less than all of its cyclic rotations.

Examples

			The a(1) = 1 through a(8) = 18 Lyndon compositions (empty column not shown):
  (1)  (12)  (13)   (14)    (15)     (16)      (17)
             (112)  (23)    (114)    (25)      (35)
                    (113)   (123)    (34)      (116)
                    (1112)  (132)    (115)     (125)
                            (1113)   (1114)    (134)
                            (11112)  (1123)    (143)
                                     (1132)    (152)
                                     (1213)    (1115)
                                     (11113)   (1214)
                                     (11212)   (1232)
                                     (111112)  (11114)
                                               (11123)
                                               (11132)
                                               (11213)
                                               (11312)
                                               (111113)
                                               (111212)
                                               (1111112)
		

Crossrefs

The non-Lyndon version is A328609 or A318748 (with singletons).
The non-Lyndon non-circular version is A167606.
The version with singletons is A318745.
The necklace case is A328597 or A318728 (with singletons).
The aperiodic case is A328670.
Lyndon compositions are A059966, with relatively prime case A318731.

Programs

  • Mathematica
    aperQ[q_]:=Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
    neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],aperQ[#]&&neckQ[#]&&And@@CoprimeQ@@@Partition[#,2,1,1]&]],{n,10}]
  • PARI
    b(n, q, pred)={my(M=matrix(n, n)); for(k=1, n, M[k, k]=pred(q, k); for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); M[q, ]}
    seq(n)={my(v=sum(k=1, n, k*b(n, k, (i, j)->gcd(i, j)==1))); vector(n, n, sumdiv(n, d, moebius(d)*v[n/d])/n)} \\ Andrew Howroyd, Nov 01 2019

Formula

a(n > 1) = A318745(n) - 1.
Showing 1-6 of 6 results.