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.

User: Xiangyu Chen

Xiangyu Chen's wiki page.

Xiangyu Chen has authored 7 sequences.

A340108 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] in a circle with longest consecutive chain size less than 3, when 1 and n are considered to be consecutive, and rotations are considered to be distinct.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 3, 6, 0, 1, 4, 12, 0, 16, 1, 5, 20, 30, 80, 60, 1, 6, 30, 84, 264, 480, 456, 1, 7, 42, 168, 672, 1890, 3612, 3458, 1, 8, 56, 288, 1424, 5440, 15744, 30352, 29296, 1, 9, 72, 450, 2664, 12870, 50004, 145656, 283104, 275166, 1, 10, 90, 660, 4560, 26640, 130080, 508060, 1488960, 2909700, 2843980
Offset: 0

Author

Xiangyu Chen, Dec 28 2020

Keywords

Comments

In a convex n-gon, the number of cycles using k non-repeated vertices and fewer than 3 vertices (2 sides) in a row.

Examples

			n\k   0     1      2      3     4     5     6     7     8
0     1
1     1     1
2     1     2      2
3     1     3      6      0
4     1     4     12      0     16
5     1     5     20     30     80    60
6     1     6     30     84    264   480    456
7     1     7     42    168    672  1890   3612  3458
8     1     8     56    288   1424  5440  15744 30352 29296
		

Crossrefs

Formula

T(n,k) = n*(5*A340106(n-1,k-1) - 2*Z(n,k) - Z(n-1,k-1) - 2*S(n,k) - 2*S(n-2,k-2)) except for T(n,0)=1, where S(n,k) = 2*A340106(n-1,k-1) - 2*A340106(n-2,k-2) + S(n-3,k-3), S(n,k)=0 for k <= 0, Z(n,k) = 2*A340106(n-1,k-1) - S(n,k) - V(n-1,k-1), Z(n,k)=0 for k <= 0, V(n,k) = Z(n-1,k-1) - V(n-1,k-1), V(n,k)=0 for k <= 0 except for V(2,2)=2.

Extensions

Terms of column 2 corrected by Xiangyu Chen, Aug 19 2022

A340107 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] with longest consecutive chain size less than 3, when 1 and n are considered to be consecutive.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 3, 6, 0, 1, 4, 12, 16, 16, 1, 5, 20, 50, 90, 80, 1, 6, 30, 108, 300, 552, 516, 1, 7, 42, 196, 742, 2100, 3990, 3794, 1, 8, 56, 320, 1536, 5888, 16976, 32656, 31456, 1, 9, 72, 486, 2826, 13680, 53046, 154350, 299628, 290970, 1, 10, 90, 700, 4780, 27960, 136380, 532340, 1559040, 3044900, 2974380
Offset: 0

Author

Xiangyu Chen, Dec 28 2020

Keywords

Comments

In a convex n-gon, the number of paths using k non-repeated vertices and fewer than 3 vertices (2 sides) in a row.

Examples

			n\k   0     1     2     3     4     5     6     7     8
0     1
1     1     1
2     1     2      2
3     1     3      6      0
4     1     4     12     16     16
5     1     5     20     50     90    80
6     1     6     30    108    300   552    516
7     1     7     42    196    742  2100   3990  3794
8     1     8     56    320   1536  5888  16976 32656 31456
		

Crossrefs

Formula

T(n,k) = n*(A340106(n-1,k-1) - S(n-2,k-2)) except for T(n,0)=1, where S(n,k) = 2*A340106(n-1,k-1) - 2*A340106(n-2,k-2) + S(n-3,k-3), S(n,k)=0 for k <= 0. [exception added by Xiangyu Chen, Aug 19 2022]

A340106 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] with longest consecutive chain size less than 3.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 1, 3, 6, 4, 1, 4, 12, 20, 18, 1, 5, 20, 54, 100, 92, 1, 6, 30, 112, 318, 600, 570, 1, 7, 42, 200, 768, 2208, 4244, 4082, 1, 8, 56, 324, 1570, 6080, 17682, 34300, 33292, 1, 9, 72, 490, 2868, 13980, 54552, 159702, 311808, 304490, 1, 10, 90, 704, 4830, 28392, 139130, 545528, 1604616, 3147164, 3086890
Offset: 0

Author

Xiangyu Chen, Dec 28 2020

Keywords

Comments

In a convex n-gon, the number of paths using k non-repeated vertices and fewer than 3 vertices (2 sides) in a row, except side (1,n) is unrestricted.

Examples

			n\k   0     1      2      3      4     5     6     7     8
0     1
1     1     1
2     1     2      2
3     1     3      6      4
4     1     4     12     20     18
5     1     5     20     54    100    92
6     1     6     30    112    318   600    570
7     1     7     42    200    768  2208   4244  4082
8     1     8     56    324   1570  6080  17682 34300 33292
		

Crossrefs

Right diagonal is A095816.

Formula

T(n,k) = A340107(n,k) + 2*O(n-1,k-1) + O(n-2,k-2), where O(n,k) = 2*(k-1)*T(n-1,k-1)/(n-1) - 2*O(n-1,k-1) + 3*O(n-2,k-2) + 2*O(n-3,k-3) + O(n-4,k-4), O(n,k)=0 for k<=1.

A338849 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] in a circle where adjacent values cannot be consecutive modulo n, rotations are distinct.

Original entry on oeis.org

1, 1, 1, 1, 2, 0, 1, 3, 0, 0, 1, 4, 4, 0, 0, 1, 5, 10, 0, 0, 10, 1, 6, 18, 12, 24, 60, 36, 1, 7, 28, 42, 112, 280, 420, 322, 1, 8, 40, 96, 336, 1040, 2400, 3696, 2832, 1, 9, 54, 180, 792, 3060, 9540, 22428, 35280, 27954, 1, 10, 70, 300, 1600, 7540, 29880, 95340, 229280, 369540, 299260
Offset: 0

Author

Xiangyu Chen, Nov 12 2020

Keywords

Comments

In a convex n-gon, the number of paths using k-1 diagonals and k non-repeated vertices, start and end vertices are not connected by a side.

Examples

			n\k  0    1    2    3    4    5    6    7    8
0    1
1    1    1
2    1    2    0
3    1    3    0    0
4    1    4    4    0    0
5    1    5    10   0    0    10
6    1    6    18   12   24   60   36
7    1    7    28   42   112  280  420  322
8    1    8    40   96   336  1040 2400 3696 2832
		

Crossrefs

Formula

T(n,k) = n*(A338526(n-1,k-1)-2*S(n-1,k-1)+Z2(n-1,k-1)) for k>0 except T(2,2)=0, T(n,0)=1, where Z2(n,k) = Z1(n,k) except Z2(n,1)=2, where Z1(n,k) = S(n-1,k-1)-Z(n-1,k-1) for k>0 except Z1(2,2)=0, Z1(n,0)=0, where S(n,k) = 2*A338526(n-1,k-1)-S(n-1,k-1) for k>0, S(n,0)=0.

A338838 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] where adjacent values cannot be consecutive modulo n.

Original entry on oeis.org

1, 1, 1, 1, 2, 0, 1, 3, 0, 0, 1, 4, 4, 0, 0, 1, 5, 10, 10, 10, 10, 1, 6, 18, 36, 60, 84, 60, 1, 7, 28, 84, 210, 434, 630, 462, 1, 8, 40, 160, 544, 1552, 3440, 5168, 3920, 1, 9, 54, 270, 1170, 4338, 13158, 30366, 47178, 36954, 1, 10, 70, 420, 2220, 10220, 39780, 125220, 298060, 476220, 382740
Offset: 0

Author

Xiangyu Chen, Nov 11 2020

Keywords

Comments

In a convex n-gon, the number of paths using k-1 diagonals and k non-repeated vertices.

Examples

			n\k  0    1    2    3    4    5    6    7    8
0    1
1    1    1
2    1    2    0
3    1    3    0    0
4    1    4    4    0    0
5    1    5    10   10   10   10
6    1    6    18   36   60   84   60
7    1    7    28   84   210  434  630  462
8    1    8    40   160  544  1552 3440 5168 3920
		

Crossrefs

Right diagonal is A002493.

Programs

  • PARI
    isokd(d, n) = my(x=abs(d)); (x==1) || (x==(n-1));
    isok(s, p, n) = {my(w = vector(#s, k, s[p[k]])); for (i=1, #s-1, if (isokd(w[i+1] - w[i], n) == 1, return (0))); return (1);}
    T(n, k) = {my(nb = 0); forsubset([n, k], s, for(i=1, k!, if (isok(s, numtoperm(k, i), n), nb++););); nb;} \\ Michel Marcus, Nov 21 2020

Formula

T(n,k) = n*(A338526(n-1,k-1)-S(n-1,k-1)) for k>0 except T(2,2)=0, T(n,0)=1, where S(n,k) = 2*A338526(n-1,k-1)-S(n-1,k-1) for k>0, S(n,0)=0.

A338526 Triangle read by rows: T(n,k) is the number of permutations of k elements from [1..n] without consecutive adjacent values.

Original entry on oeis.org

1, 1, 1, 1, 2, 0, 1, 3, 2, 0, 1, 4, 6, 4, 2, 1, 5, 12, 18, 20, 14, 1, 6, 20, 48, 90, 124, 90, 1, 7, 30, 100, 272, 582, 860, 646, 1, 8, 42, 180, 650, 1928, 4386, 6748, 5242, 1, 9, 56, 294, 1332, 5110, 15912, 37566, 59612, 47622, 1, 10, 72, 448, 2450, 11604, 46250, 148648, 360642, 586540, 479306
Offset: 0

Author

Xiangyu Chen, Nov 07 2020

Keywords

Comments

Also number of ways to arrange n non-attacking kings on an n X k board, with 0 or 1 in each row and 1 in each column. - Ron L.J. van den Burg, Aug 04 2024

Examples

			n\k  0    1    2    3    4    5    6    7    8
0    1
1    1    1
2    1    2    0
3    1    3    2    0
4    1    4    6    4    2
5    1    5    12   18   20   14
6    1    6    20   48   90   124  90
7    1    7    30   100  272  582  860  646
8    1    8    42   180  650  1928 4386 6748 5242
		

Crossrefs

Diagonal is A002464.
T(2n,n) gives A375022.

Programs

  • PARI
    isok(s, p) = {for (i=1, #s-1, if (abs(s[p[i+1]] - s[p[i]]) == 1, return (0));); return (1);}
    T(n, k) = {my(nb = 0); forsubset([n, k], s, for(i=1, k!, if (isok(s, numtoperm(k, i)), nb++););); nb;} \\ Michel Marcus, Nov 17 2020

Formula

T(n,k) = (n! + Sum_{p=1..k-1} (-1)^p (n-p)! Sum_{r=1..p} 2^r binomial(k-p,r) binomial(p-1,r-1) )/(n-k)!. - Ron L.J. van den Burg, Aug 04 2024
O.g.f.: Sum_{n>=0} Sum_{k=0..n} T(n,k)*x^n*y^k = Sum_{i>=0} i!(x*y*(1-x*y)/(1+x*y))^i/(1-x)^(i+1). - Ron L.J. van den Burg, Aug 14 2024

A330732 a(n) is the smallest number whose odd hailstone sequence has length n (including 1 and itself) and is in descending order.

Original entry on oeis.org

1, 5, 13, 17, 45, 241, 321, 1713, 9137, 24365, 36033, 173261, 231681, 630033, 1642769, 4380717, 11715629, 31241677, 41655569, 111081517, 148108689, 789913009, 1053217345, 1404289793, 3744772781, 9986060749, 13314747665, 35505993773, 94682650061, 128599099649
Offset: 1

Author

Xiangyu Chen, Dec 28 2019

Keywords

Comments

The hailstone (Collatz) sequence of a number is defined by repeated operations of f(x), where f(x)=x/2 if x is even, and f(x)=3x+1 if x is odd. The odd numbers of a number's hailstone sequence are also called its odd hailstone sequence.
The odd hailstone sequence of 45 [45, 17, 13, 5, 1] contains the first five terms of this sequence.
Note that a(n+1) isn't necessarily greater than a(n).

Examples

			Consider a(8): [1713, 1285, 241, 181, 17, 13, 5, 1]; the odd hailstone sequence of 1713 is descending and has length 8. 1713 is the lowest such number.
		

Crossrefs

Programs

  • Mathematica
    With[{s = Array[If[AllTrue[Differences@ #, # < 0 &], Length@ #, 0] &@ Select[NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, #, # > 1 &], OddQ] &, 10^5]}, Array[FirstPosition[s, #][[1]] &, Max@ s]] (* Michael De Vlieger, Jan 01 2020 *)
  • PARI
    is(k, n) = {my(x=k, v=List([])); while(x>1, if(x%2==0, x=x/2, listput(v, x); x=3*x+1)); 1+#v==n&&v==vecsort(v, , 4); }
    a(n) = {k=1; while(is(k, n)==0, k+=2); k; } \\ Jinyuan Wang, Dec 31 2019

Extensions

a(23)-a(30) from Kevin P. Thompson, Jul 23 2022