Find perfect dividable numbers

115 Views Asked by At

I'm really no math expert but a decent web developer with a simple problem.

I have a gallery with items. I can decide how many items I show on each page. I'll give an example...

Example with 9 in a row

Match row length

Each line is filled up with 3 in a row. Nice!

|x|x|x|
|x|x|x|
|x|x|x|

Does not match row length

When having 4 in a row, it "breaks".

|x|x|x|x|
|x|x|x|x|
|x|

Conclusion: 9 is only a good items number for 1, 3 and 9 in a row. But not for 2, 4 and 5.

Question

  • The number 9 is not a very good number, because it's often get uneven to the row length.
  • The number 12 is much better as it match 1, 2, 3 and 4. It starts perfectly with the first four numbers dividable. I could only wish it would be dividable with 5 etc as well. The number 12 is better than 9 in this case.

Are there more perfect numbers? I don't need more than 8 in a row.

For other readers here, I guess a math formula would be really helpful as well.