A Bright, Vibrant Blue Diamond
A Bright, Vibrant Blue Diamond
John Æonid, Reflections in a Personal Web Site
John Æonid, Reflections in a Personal Web Site

Squares And Triangular Numbers

Nov. 11, 2019, John Æonid — VERY ROUGH DRAFT, YET TO BE PROOFED

Four people in a room all shake hands with each other exactly once.  How many times did they shake hands?

 

It relates to the square of the number but is less than that, because no one shakes hands with themselves.  But, each person does shake hands with every other person, and every other person is one less than the number of people.    But, the shaking of hands is non-directional.  So, you can't just take n(n-1); you have to take half of that.  That gives us n(n-1)/2.  If you fill a table with the pairs of people that shake hands, what you find that the cells of the table that are filled once for each pair of people that shake hands, what you see is that the filled cells form a triangle.

 

And, as it happens with the two terms n and n-1, exactly one of them will always be an even number.  So, these can often be easy to work out in one's head.  The number four yields four and three, and four is even, so divide four in half, and multiply that by three.  That makes two times three. 

This formula has become a favorite of mine.  It is the formula for counting how many non-directional connections there can be among some number of things.  Computer Science calls this a complete graph.  As a study of these numbers and related numbers as well, I've generated the first 24 of these.

My motivation for this was the realization that the number 12 has factors that are two triangular numbers, 2 and 3, as well as the product of triangular number, 3 and the square that follows it, 4.  And, the number 12 has proven to be very useful in creating schemes that are conveniently divisible by these numbers.

Legend for Table That Follows
n number of entities to connect
sq n2
trip n(n+1)
htrip n(n+1)/2
trim n(n-1)
htrim n(n-1)/2
tripPrd n(n+1) * tripi-1
htripPrd n(n-1) * htripi-1
trimPrd n(n-1) * trimi-1
htrimPrd n(n-1)/2 * htrimi-1
n sq trip htrip trim htrim tripPrd htripPrd trimPrd htrimPrd
2 4 6 3 2 1 0 0 0 0
3 9 12 6 6 3 72 18 12 3
4 16 20 10 12 6 240 60 72 18
5 25 30 15 20 10 600 150 240 60
6 36 42 21 30 15 1260 315 600 150
7 49 56 28 42 21 2352 588 1260 315
8 64 72 36 56 28 4032 1008 2352 588
9 81 90 45 72 36 6480 1620 4032 1008
10 100 110 55 90 45 9900 2475 6480 1620
11 121 132 66 110 55 14520 3630 9900 2475
12 144 156 78 132 66 20592 5148 14520 3630
13 169 182 91 156 78 28392 7098 20592 5148
14 196 210 105 182 91 38220 9555 28392 7098
15 225 240 120 210 105 50400 12600 38220 9555
16 256 272 136 240 120 65280 16320 50400 12600
17 289 306 153 272 136 83232 20808 65280 16320
18 324 342 171 306 153 104652 26163 83232 20808
19 361 380 190 342 171 129960 32490 104652 26163
20 400 420 210 380 190 159600 39900 129960 32490
21 441 462 231 420 210 194040 48510 159600 39900
22 484 506 253 462 231 233772 58443 194040 48510
23 529 552 276 506 253 279312 69828 233772 58443
24 576 600 300 552 276 331200 82800 279312 69828
0 27
1 1
2 1
3 2
4 1
6 3
9 1
10 1
12 3
15 1
16 1
18 2
20 2
21 1
25 1
28 1
30 2
36 2
42 2
45 1
49 1
55 1
56 2
60 2
64 1
66 1
72 4
78 1
81 1
90 2
91 1
100 1
105 1
110 2
120 1
121 1
132 2
136 1
144 1
150 2
153 1
156 2
169 1
171 1
182 2
190 1
196 1
210 3
225 1
231 1
240 4
253 1
256 1
272 2
276 1
289 1
306 2
315 2
324 1
342 2
361 1
380 2
400 1
420 2
441 1
462 2
484 1
506 2
529 1
552 2
576 1
588 2
600 3
1008 2
1260 2
1620 2
2352 2
2475 2
3630 2
4032 2
5148 2
6480 2
7098 2
9555 2
9900 2
12600 2
14520 2
16320 2
20592 2
20808 2
26163 2
28392 2
32490 2
38220 2
39900 2
48510 2
50400 2
58443 2
65280 2
69828 2
82800 1
83232 2
104652 2
129960 2
159600 2
194040 2
233772 2
279312 2
331200 1
$ perl -E '
say "<table>";
@fw = qw(
  2 5
  5 5 5 5
  8 8 8 8
);
say "  <thead>";
$fmt = join "", map { "<th>%" . $_ . "s</th>" } @fw;
printf "     <tr>$fmt</tr>\n", qw(
  n sq
  trip htrip trim htrim
  tripPrd htripPrd trimPrd htrimPrd
);
say "  </thead>";
say "  <tbody>";
$fmt = join "", map { "<td>%" . $_ . "i</td>" } @fw;
for $ni (2..24) {
  $sq = $ni ** 2;
  $trip = $ni * ( $ni + 1 );
  $trim = $ni * ( $ni - 1 );
  $htrim = $trim / 2;
  $htrip = $trip / 2;
  $tripPrd = $tripPrv * $trip;
  $htripPrd = $htripPrv * $htrip;
  $trimPrd = $trimPrv * $trim;
  $htrimPrd = $htrimPrv * $htrim;
  printf "    <tr>$fmt</tr>\n",
    $ni, $sq,
    $trip, $htrip, $trim, $htrim,
    $tripPrd, $htripPrd, $trimPrd, $htrimPrd;
  $tripPrv = $trip;
  $htripPrv = $htrip;
  $trimPrv = $trim;
  $htrimPrv = $htrim;
  $li{$sq}++;
  $li{$trip}++;
  $li{%htrip}++;
  $li{$trim}++;
  $li{$htrim}++;
  $li{$tripPrd}++;
  $li{$htripPrd}++;
  $li{$trimPrd}++;
  $li{$htrimPrd}++;
}
say "  </tbody>";
say "</table>";
say "";
say "<table>";
for $ky (sort {$a <=> $b} keys %li) {
  printf "  <tr><td>%7i</td><td>%2i</td></tr>\n", $ky, $li{$ky};
}
say "</table>";'

News

Nov. 8, 2019 Shadow
I've replaced the home page, though the old is retained, and I'm going deeper into shining light on the shadow, taking more risks..

May 14, 2017 Listing
I'm now generating a chronological list of postings here (in addition to the sitemap).

Jan. 14, 2017 WOT
I now participate in WOT.

Oct. 20, 2016 New Website!
This is truly in its infancy.  There is much that I want to share, yet it's just beginning.

Print | Sitemap
© 2018 John Æonid All rights reserved
End-User License Agreement — MUST READ