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: Ian Duff

Ian Duff's wiki page.

Ian Duff has authored 5 sequences.

A309053 Triangular array T read by rows: T(r,c) is the number of double permutations of the integers from 1 to r which have exactly c different values visible when viewed from the left, in the sense that a higher number hides a lower one.

Original entry on oeis.org

1, 0, 1, 0, 1, 3, 0, 4, 17, 15, 0, 36, 181, 254, 105, 0, 576, 3220, 5693, 3966, 945, 0, 14400, 86836, 177745, 161773, 67251, 10395, 0, 518400, 3313296, 7527688, 8134513, 4524085, 1248483, 135135
Offset: 0

Author

Ian Duff, Jul 09 2019

Keywords

Comments

Consider r rectangular cards stacked in a pile with their left and lower edges aligned. Each is of a different color and their widths and heights are independent permutations of the integers 1, 2, ..., r. Then the sequence gives the number of ways in which exactly c colors may be seen, where 0 <= c <= r. The values are entries in a triangular table read from left to right along successive rows from the top, each row giving the value of r and each column giving the value of c. Including a row in the triangle for r = 0 and treating the values as a list a(n) starting with n = 1, n = r(r+1)/2 + c + 1.
For example, r = 2. If the widths of the cards from the top of the stack are 1,2 and the heights are 1,2 then two colors are seen; if the widths are 1,2 and the heights are 2,1 then two colors are seen; if 2,1 and 1,2 then two colors are seen; if 2,1 and 2,1 then only one color is seen. Thus the values for c = 1 and c = 2 are 1 and 3 respectively, i.e., a(5) = 1 and a(6) = 3.
The sum of row r in the table is (r!)^2 and T(r,1) for r > 0 is ((r-1)!)^2.

Examples

			The triangle up to r = 7 is:
  r\c   0      1       2       3       4       5       6      7
  0     1
  1     0      1
  2     0      1       3
  3     0      4      17      15
  4     0     36     181     254     105
  5     0    576    3220    5693    3966     945
  6     0  14400   86836  177745  161773   67251   10395
  7     0 518400 3313296 7527688 8134513 4524085 1248483 135135
		

Crossrefs

Row sums and T(r,1) for r > 0 give A001044.
Main diagonal gives A001147.
Cf. A132393, giving the analogous table for a single permutation, i.e., cards varying only by width or by height.

Programs

  • BASIC
    r=5
    fr=1
    for i=2 to r : fr=fr*i : next i            ' fr=r!
    dim perm(fr,r), a(fr,r), b(r), count(r), p(r)
    for i=1 to fr : for j=1 to r : a(i,j)=0 : next j : next i
    for i=1 to r : count(i)=0 : next i
    '*** now derive successive permutations p() and populate rows of perm()
    for k=0 to fr-1
       for i=1 to r : p(i)=i : next i
       f=1
       for j=2 to r
          f=f*(j-1)
          a=int(k/f)
          i=a mod j
          x=p(j-i) : p(j-i)=p(j) : p(j)=x
       next j
       for i=1 to r
          perm(k+1,i)=p(i)
       next i
    next k
    '***
    '*** now determine which numbers are visible for each permutation and
    '     put in a()
    for k=1 to fr
       max=perm(k,1)
       a(k,perm(k,1))=1
       for i=2 to r
          if perm(k,i)>max then max=perm(k,i) : a(k,perm(k,i))=1
       next i
    next k
    '***
    '*** now determine which numbers [b()], and how many [count()], are
    '     visible for each combination of permutations
    for i=1 to fr
       for j=1 to fr
          tb=0
          for k=1 to r
             b(k)=0 : if a(i,k)=1 or a(j,k)=1 then b(k)=1
             tb=tb+b(k)
          next k
          count(tb)=count(tb)+1
       next j
    next i
    '***
    for c=1 to r
       print c;"   ";count(c)
    next c

A322253 Number of circular permutations of the integers from 0 to n which generate a complete stepping-on sequence, when the stepping-on direction depends on the odd/even parity of the current value.

Original entry on oeis.org

1, 2, 2, 4, 4, 48, 24, 32, 288, 3072, 3856, 38272, 89328, 1294080
Offset: 1

Author

Ian Duff, Dec 01 2018

Keywords

Comments

There are n! circular permutations of the integers from 0 to n. Only some have the property that a complete sequence of these integers can be found by choosing a start value then continuing to move left or right by the number of steps indicated, the direction of each move depending on whether the current value is odd or even. For example, of the six permutations for n = 3, only 0132 and 0213 generate a complete sequence if an odd value gives a leftward move that number of places and an even value gives a rightward move that number of places. If the direction rule is reversed, the two valid permutations are 0231 and 0312, the reverse of the previous two. Thus a(3) = 2.
Putting 0 in position 1 at the left and counting rightwards, the starting position for a complete sequence is 2 + floor(n/2) for the rule odd/left, even/right and floor((n+3)/2) for the opposite rule. As a further example, one of the a(9) = 288 valid permutations using the former rule for n = 9 is 0986423175. Starting at position 2 + floor(9/2), i.e., 6, the sequence 2, 1, 3, 6, 5, 4, 7, 9, 8, 0 is found. Clearly, all such sequences end with zero.
It is conjectured that the sequence continues indefinitely.
From David A. Corneth, Dec 05 2018: (Start)
For even n, if [d1, d2, ..., dn] is a valid permutation then so is [n + 1 - d1, n + 1 - d2, ..., n + 1 - dn] which is a different permutation.
More generally, for any valid permutation where n is even, di and n+1 - di can be interchanged for any value (where n + 1 - di != di) to give another valid permutation. Hence a(n) is divisibly by 2^k for n = 2*k.
a(n) > 0. For n = 1, [0, 1] is valid, for n = 2, [0, 1, 2] is valid; for n = 3, [0, 3, 1, 2] is valid etc. By taking this valid tuple from n by adding n + 1 to the right of the permutation or to the right of the 0, depending on the parity of n, one finds another valid tuple. Hence a(n) > 0. (End)
For the complementary case where stepping-on is always in the same direction, no permutation of 0 to n with n even can generate a complete sequence. For odd n, the number of complete sequences corresponds to A141599((n + 1)/2) for n up to 11, as limited by available computing power - it is conjectured that this correspondence continues indefinitely. - Ian Duff, Dec 25 2018

Crossrefs

a(2n - 1) = A141599(n) for n up to 7, again limited by available computing power. It is conjectured that the correspondence continues indefinitely.

Programs

Extensions

a(12)-a(14) from David A. Corneth, Dec 04 2018

A139378 Number of 2-digit multiples of n whose digits sum to n.

Original entry on oeis.org

1, 1, 3, 1, 1, 3, 1, 1, 9
Offset: 1

Author

Ian Duff, Jun 08 2008

Keywords

Examples

			a(1)=1 as 10 is the only 2-digit multiple of 1 whose digits sum to 1, while a(3)=3 as the multiples 12, 21 and 30 have the property.
		

A139384 The number of 3-digit multiples of n whose digits sum to n.

Original entry on oeis.org

1, 2, 6, 3, 5, 12, 4, 5, 45, 9, 8, 17, 5, 5, 13, 4, 4, 25, 1, 0, 4, 0, 0, 1, 0, 0, 1
Offset: 1

Author

Ian Duff, Jun 08 2008

Keywords

Examples

			a(1)=1 as 100 is the only 3-digit multiple of 1 whose digits sum to 1, while a(19)=1 as 874 is the only 3-digit multiple of 19 with the property.
		

Programs

  • Mathematica
    dm3[n_]:=Module[{min=n*Ceiling[100/n],max=n*Floor[999/n]},Length[ Select[Range[min,max,n],Total[IntegerDigits[#]]==n&]]]; Array[dm3,30] (* Harvey P. Dale, Dec 18 2011 *)

A127376 Perpetual calendar, giving the calendar for successive years of the 400-year cycle starting in year xy01, where xy is a 2-digit multiple of 4. Calendars 1 to 7 are for normal years starting on Monday, Tuesday, ..., Sunday; 8 to 14 are for leap years likewise.

Original entry on oeis.org

1, 2, 3, 11, 6, 7, 1, 9, 4, 5, 6, 14, 2, 3, 4, 12, 7, 1, 2, 10, 5, 6, 7, 8, 3, 4, 5, 13, 1, 2, 3, 11, 6, 7, 1, 9, 4, 5, 6, 14, 2, 3, 4, 12, 7, 1, 2, 10, 5, 6, 7, 8, 3, 4, 5, 13, 1, 2, 3, 11, 6, 7, 1, 9, 4, 5, 6, 14, 2, 3, 4, 12, 7, 1, 2, 10, 5, 6, 7, 8, 3, 4, 5, 13, 1, 2, 3, 11, 6, 7, 1, 9, 4, 5, 6, 14, 2
Offset: 1

Author

Ian Duff, Mar 30 2007

Keywords

Comments

A090651 gives the 14-year repeating cycle applying between century years not a multiple of 400; this sequence extends that to the complete 400-year cycle.

Examples

			2001 is an ordinary year starting on a Monday, as a(1)=1; 2004 is a leap year starting on a Thursday, as a(4)=11; 2400 is a leap year starting on Saturday, as a(400)=13.
		

Crossrefs

Cf. A090651.

Programs

  • BASIC
    a(0)=13
    for n=1 to 400
    if (n mod 4 =0 and n mod 100 <>0) or n mod 400 =0 then
    a(n)=a(n-1)+8 : if a(n)>14 then a(n)=a(n)-7
    else
    if (n-1 mod 4 =0 and n-1 mod 100 <>0) or n-1 mod 400 =0 then
    a(n)=a(n-1)-5
    else
    a(n)=a(n-1)+1
    end if
    if a(n)>7 then a(n)=a(n)-7
    end if
    next n