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: Thomas Oléron Evans

Thomas Oléron Evans's wiki page.

Thomas Oléron Evans has authored 3 sequences.

A338671 a(n) is the number of distinct ways of arranging n identical square tiles into two rectangles.

Original entry on oeis.org

0, 1, 1, 2, 3, 4, 5, 7, 7, 10, 10, 13, 14, 16, 16, 21, 20, 25, 24, 29, 28, 34, 30, 40, 36, 43, 40, 50, 44, 55, 49, 60, 55, 66, 55, 75, 64, 75, 70, 86, 72, 92, 77, 97, 87, 103, 84, 116, 94, 114, 104, 126, 102, 135, 109, 138, 123, 143, 117, 164, 128, 153, 138, 171
Offset: 1

Author

Thomas Oléron Evans, Apr 23 2021

Keywords

Comments

Note that rectangles of size 0 are not accepted (i.e., the tiles may not be formed into a single rectangle).
Finding a(n) is equivalent to counting the positive integer solutions (x,y,z,w) of n = xy + zw such that:
i) x >= y,z,w
ii) z >= w
iii) if x = z then y >= w
These conditions ensure that identical pairs are not counted twice by permuting the values of the variables.

Examples

			a(5) = 3, since there are 3 ways to form 2 rectangles from 5 identical square tiles:
1) 2 X 2  and  1 X 1
2) 3 X 1  and  2 X 1
3) 4 X 1  and  1 X 1
Note that rotation through 90 degrees and/or exchanging the order of the two rectangles in a pair naturally do not create a distinct pair. For example, the pair 2 X 1 and 1 X 3 is not distinct from pair 2 above.
		

Crossrefs

Cf. A038548, A338664, A055507 (where a(n) is the number of ordered ways to express n+1 as a*b+c*d with 1 <= a,b,c,d <= n).

Programs

  • PARI
    a(n) = {(sum(k=1, n-1, ((numdiv(k)+1)\2)*((numdiv(n-k)+1)\2)) + if(n%2==0, (numdiv(n/2)+1)\2))/2} \\ Andrew Howroyd, Apr 29 2021
  • Python
    import numpy as np
    # This sets the number of terms:
    nits = 20
    # This list will contain the sequence
    seq = []
    # The indices of the sequence:
    for i in range(1,nits + 1):
        # This variable counts the pairs found for each total area i
        count = 0
        # The longest side of either rectangle:
        for a in range(1,i):
            # The other side of the same rectangle:
            for b in np.arange(1,1 + min(a,np.floor(i/a))):
                # Calculate the area of this rectangle and the remaining area:
                area1    = a*b
                rem_area = i - a*b
                # The longer side of the second rectangle:
                for c in np.arange(1,1 + min(a,rem_area)):
                    # The shorter side of the second rectangle:
                    d = rem_area / c
                    # Check that the solution is valid and not double counted:
                    if d != int(d) or d > min(a,c) or (a == c and d > b):
                        continue
                    # Count the new pair found:
                    count += 1
        # Add to the sequence:
        seq.append(count)
    for an in seq:
        print(an)
    

Formula

G.f.: (B(x)^2 + B(x^2))/2 where B(x) is the g.f. of A038548. - Andrew Howroyd, Apr 29 2021

A338664 a(n) is the number of ways that n square tiles can be formed into two rectangles, such that those rectangles fit orthogonally into the minimal bounding square that can contain n such tiles, without overlap.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 2, 1, 1, 4, 2, 4, 2, 2, 1, 2, 4, 4, 4, 4, 3, 2, 2, 1, 2, 6, 5, 6, 2, 7, 2, 3, 2, 2, 1, 3, 6, 6, 6, 5, 4, 6, 4, 2, 3, 2, 2, 1, 3, 8, 4, 10, 4, 6, 3, 9, 2, 4, 2, 3, 2, 2, 1, 4, 5, 10, 6, 6, 8, 4, 4, 9, 4, 2
Offset: 1

Author

Thomas Oléron Evans, Apr 22 2021

Keywords

Comments

Note that rectangles of size 0 are not accepted (i.e., the tiles may not be formed into a single rectangle).
Finding a(n) is equivalent to counting the positive integer solutions (x,y,z,w) of n = xy + zw such that:
i) x,y,z,w <= ceiling(sqrt(n))
ii) min(x,y) + min(w,z) <= ceiling(sqrt(n))
iii) x >= y,z,w
iv) z >= w
v) if x = z then y >= w
Note that ceiling(sqrt(n)) is the side length of the minimal bounding square into which n unit square tiles can be orthogonally placed, without overlap.
Therefore, i) states that neither rectangle should be longer than the bounding square, while ii) states that the two rectangles must fit side by side within this square.
iii)-v) ensure that rectangles are not double counted through permuting the values of the variables.

Examples

			a(18) = 4.
18 unit square tiles fit orthogonally into a square of side length 5 (the minimum) without overlap. There are four possible pairs of rectangles that can be formed with the 18 tiles that can then be fit orthogonally into such a square without overlap:
1) 4 X 3  and  3 X 2
2) 4 X 4  and  2 X 1
3) 5 X 2  and  4 X 2
4) 5 X 3  and  3 X 1
Case 1      Case 2      Case 3      Case 4
1 1 1 - -   1 1 1 1 -   1 1 1 1 1   1 1 1 - -
1 1 1 - -   1 1 1 1 -   1 1 1 1 1   1 1 1 - 2
1 1 1 2 2   1 1 1 1 2   - 2 2 2 2   1 1 1 - 2
1 1 1 2 2   1 1 1 1 2   - 2 2 2 2   1 1 1 - 2
- - - 2 2   - - - - -   - - - - -   1 1 1 - -
Note that other pairs of rectangles with total area 18, e.g., 3 X 3 and 3 X 3, or 6 X 2 and 3 X 2 are not counted, since they could not fit together into the minimal (5 X 5) bounding square.
		

Crossrefs

Cf. A338671, A055507 (where a(n) is the number of ordered ways to express n+1 as a*b+c*d with 1 <= a,b,c,d <= n).

Programs

  • Python
    import numpy as np
    # This sets the number of terms:
    nits = 20
    # This list will contain the complete sequence:
    seq_entries = []
    # i is the index of the term to be calculated:
    for i in range(1, nits + 1):
        # This variable counts the rectangle pairs:
        count = 0
        # Calculate the side length of the minimal bounding square:
        bd_sq_side = np.ceil(np.sqrt(i))
        # Looking for pairs of rectangles of sizes a x b and c x d (all integers)
        # such that both can fit orthogonally into the minimal bounding square (integer side length)
        # WLOG suppose that:
        # a is the greatest of a, b, c, d...
        # c >= d
        # if a = c then b >= d
        # a rectangle of size 0 X 0 is not acceptable
        # The longest side length of either rectangle:
        for a in np.arange(1,bd_sq_side + 1):
            # The other side length of the same rectangle:
            for b in np.arange(1,1 + min(a,np.floor(i/a))):
                # Find the remaining area for the other rectangle:
                area_1   = a*b
                rem_area = i - area_1
                # If there is no remaining area, the first rectangle is not valid:
                if rem_area == 0:
                    continue
                # The shorter side of the second rectangle:
                for d in np.arange(1,1 + min(a,np.floor(np.sqrt(rem_area)))):
                    # The longer side of the second rectangle:
                    c = rem_area / d
                    # Check that the solution is valid:
                    if b + d <= bd_sq_side and c == int(c) and c <= bd_sq_side and c <= a and ((a != c) or (b >= d)):
                        count += 1
        # Add the entry calculated to the list
        seq_entries.append(count)
    for an in seq_entries:
        print(an)

A258946 Numbers that can be expressed using only the digits 0 and 1 in no more than three different bases.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 11, 14, 15, 18, 19, 22, 23, 24, 29, 32, 33, 34, 35, 38, 41, 44, 45, 46, 47, 48, 51, 52, 53, 54, 55, 58, 59, 60, 61, 62, 63, 66, 67, 70, 71, 74, 75, 76, 77, 78, 79, 83, 86, 87, 88, 89, 92, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107
Offset: 1

Author

Thomas Oléron Evans, Jun 15 2015

Keywords

Comments

All integers n >= 4 may trivially be expressed using only the digits 0 and 1 in three different bases: 2, n-1 (as '11') and n (as '10'). The numbers in this sequence cannot be expressed using only 0 and 1 in any other base.
The only positive integers that may be expressed using only the digits 0 and 1 in fewer than three different bases are 2 and 3, for which the values {2, n-1, n} are not all distinct or are not all valid bases.
An equivalent definition: For each term a(n) of this sequence, there are at most three integers k >= 2 for which a(n) is a sum of distinct nonnegative integer powers of k.

Examples

			5 is a term of the sequence, because 5 may be expressed using only the digits 0 and 1 in precisely three different bases: 2, 4 and 5 (5 is '12' in base 3).
9 is not a term of the sequence, because 9 can be expressed using only the digits 0 and 1 in four different bases: 2, 3, 8, 9 (9 is '100' in base 3).
		

Crossrefs

Subsequence of A074940.

Programs

  • Maple
    filter:= proc(n)
      local b;
      for b from 3 to n-2 do
        if max(convert(n,base,b)) <= 1 then return false
        fi
      od:
    true
    end proc:
    select(filter, [$2..1000]); # Robert Israel, Jun 19 2015
  • PARI
    is(n)=if(n<2, return(0)); for(b=3,sqrtint(n),if(vecmax(digits(n,b))<2, return(0))); 1 \\ Charles R Greathouse IV, Jun 15 2015