pick three notes from a major set class

How many three-note sets with unique interval spacings in a major scale?

The problem (as I understand it)

The set is 0, 2, 4, 5, 7, 9, 11 (or A), 12 (or B)

For this set

  1. find all the three-note subsets combinations; then
  2. remove all subsets that have the same interval spacing, excepting the subset with the lowest starting numeral

Using PHP

The following list shows the interval spacing between the three notes; and then the combinations of the three notes.

2-2
024
042
204
240
402
420
2-3
025
052
205
250
502
520
2-5
027
072
207
270
702
720
2-7
029
092
209
290
902
920
2-9
02A
0A2
20A
2A0
A02
A20
2-10
02B
0B2
20B
2B0
B02
B20
4-1
045
054
405
450
504
540
4-3
047
074
407
470
704
740
4-5
049
094
409
490
904
940
4-7
04A
0A4
40A
4A0
A04
A40
4-8
04B
0B4
40B
4B0
B04
B40
5-2
057
075
507
570
705
750
5-4
059
095
509
590
905
950
5-6
05A
0A5
50A
5A0
A05
A50
5-7
05B
0B5
50B
5B0
B05
B50
7-2
079
097
709
790
907
970
7-4
07A
0A7
70A
7A0
A07
A70
7-5
07B
0B7
70B
7B0
B07
B70
9-2
09A
0A9
90A
9A0
A09
A90
9-3
09B
0B9
90B
9B0
B09
B90
11-1
0AB
0BA
A0B
AB0
B0A
BA0
2-1
245
254
425
452
524
542
2-8
24B
2B4
42B
4B2
B24
B42
3-2
257
275
527
572
725
752
3-4
259
295
529
592
925
952
3-6
25A
2A5
52A
5A2
A25
A52
3-7
25B
2B5
52B
5B2
B25
B52
5-5
27B
2B7
72B
7B2
B27
B72
7-3
29B
2B9
92B
9B2
B29
B92
9-1
2AB
2BA
A2B
AB2
B2A
BA2
1-2
457
475
547
574
745
754
1-4
459
495
549
594
945
954
1-6
45A
4A5
54A
5A4
A45
A54
1-7
45B
4B5
54B
5B4
B45
B54
3-5
47B
4B7
74B
7B4
B47
B74
5-3
49B
4B9
94B
9B4
B49
B94
7-1
4AB
4BA
A4B
AB4
B4A
BA4
2-4
57A
5A7
75A
7A5
A57
A75
4-2
59A
5A9
95A
9A5
A59
A95
6-1
5AB
5BA
A5B
AB5
B5A
BA5

In short: 40 × 3! = 240 ;)

I didn't do the coding on my own - two functions on Stack Overflow that were not chosen as answers, but were nevertheless correct (permute by zavg; and array_combination by Piotr Salaciak.)

$n = array('0','2','4','5','7','9','11','12');
//this is really a permutation
$C = array_combination(3,$n);
$by_in = array();
echo "<dl>";
foreach($C as $c){
//create an interval class for each set
$in_f = $c[1] - $c[0];
$in_s = $c[2] - $c[1];
$in_class = "$in_f-$in_s";
//do hexadecimal notation for readability
$c = str_replace('11','A',$c);
$c = str_replace('12','B',$c);
//don't fill the interval class if it is already filled
if(!isset($by_in[$in_class])){
$by_in[$in_class] = "$c[0]$c[1]$c[2]";
echo "<dt>$in_class</dt>";
//this is really a combination
$perms = permute($by_in[$in_class]);
foreach($perms as $p){
echo "<dd>$p</dd>";
}
}
}

Could the question be rephrased (or answered differently)?

This is still early morning thinking.The PHP I cobbled together works out an "interval order class"; it takes the three notes and works out the intervals between the first and the second notes, then the second and third notes. If we work these out first, then we can calculate the rest pretty easily, without code or heavy maths.

What intervals exist in a major scale, and how many are they?

Here, tt means tritone; S means semitone, and T means tone.

1(VIII) + 2(S) + 5(T) + 3(iii) + 3(III) + 4(P4) + 4(P5) + 1(tt) + 1(vi) + 2(VI) + 1(vii) + 1(VII) = 28 intervals, 12 types

How many combinations of two interval spacings are there from the major scale?

need to exclude the octave, leaving 11 types of interval.

But this is the wrong question, because the choice of the second interval is constrained by the first.

If I pick one interval, what choices do I have for the next ascending interval within the major scale?

By hand:

First choicenext interval options
ST, III, tt, V
TT, iii, III, IV, V, vi, vii
iiiT, III, IV, tt, V, vi
IIIS, T, iii, IV, V, vi
IVT, iii, III, tt, V
VS, T, iii, III, IV
ttS
vinone
VIS, T, iii
viinone
VIIS

So 40 choices.

Two intervals produce three notes; there are 3! = 6 ways of combining three items; so 40 × 6 = 240 unique three-note sets within a major scale.