All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Shapes
Row of towers (Posted on 2024-02-23) Difficulty: 3 of 5
An assemblage of unit squares is in the form of n towers with heights 1,2,...,n forming a polyomino.

Here are two possible examples for n=4:

Find a formula for the largest possible perimeter of such a polyomino.

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Formula | Comment 2 of 5 |
Assumptions:  
- the bottom row is n solid blocks.
- maximum perimeter is when 1xn columns alternate with 1x1 columns
- wlog let leftmost column be a solid 1xn; the rightmost will either be 1xn or 1x1 depending on whether n is even or odd

The analysis below leads to the following formulae:
f_even(n) = n^2 + n + 2  if n is even
f_odd(n)  = n^2 + 2n + 1  if n is odd


1 4
2 8
3 16
4 22
5 36
6 44
7 64
8 74
9 100
10 112
11 144   (not in Sloane's oeis)

Example for n = 4:
X X
X X
X X
XXXX  I count 22

For evens:  
2n for the left side and bottom
(n-1)*(n-1) inside vertical walls
1 right side vertical wall
(n/2) tops of towers
(n/2) bottoms of valleys

Total:  2n + n^2 - 2n + 1 + 1 + n/2 + n/2
= n^2 + n + 2

For odds:
3n for the left side, right side, and bottom
(n-1)*(n-1) inside vertical walls
(n/2 + 1/2) tops of towers  
(n/2 - 1/2) bottoms of valleys

Total: 3n + n^2 - 2n + 1 + (n/2 + 1/2) + (n/2 - 1/2)
= n^2 + 2n + 1
-----
def count(n):
    if n%2 == 0:
        return int(n**2 + n + 2)
    else:
        return int(n**2 + 2*n + 1)

for n in range(1,12):
    print(n, count(n))

  Posted by Larry on 2024-02-23 15:48:38
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information