This question is motivated by a real-world application related to an art project that involves displaying images, but my search hit a dead end after finding the wikipage about [**Kirkman systems**](https://en.wikipedia.org/wiki/Kirkman%27s_schoolgirl_problem) (other related terms include [**Steiner systems**](https://en.wikipedia.org/wiki/Steiner_system) and the [**Social golfer problem**](https://en.wikipedia.org/wiki/Social_golfer_problem)) and looking over references linked there. A few people have written programs for this specific question that established lower bounds (so: more than $2100$) but none has found an exact answer.


**The question is:**



> 
> Given a set of $40$ elements, what is the maximum number of subsets, each with $4$ elements, that can be created such that no triple appears more than once?
> 
> 
> 


(For example, if the set includes $A,B,C,D,E$ as elements, then one cannot include in the collection of subsets *both* $\{A,B,C,D\}$ *and* $\{A,B,C,E\}$ since, in this scenario, we would have the triple $A,B,C$ appearing more than once.)


As an excerpt from the [**History**](https://en.wikipedia.org/wiki/Kirkman%27s_schoolgirl_problem#History) section of the aforelinked wikipage, there is under the first bullet point a question attributed to Wesley Woolhouse (1844):



> 
> "Determine the number of combinations that can be made out of $n$ symbols, $p$ symbols in each; with this limitation, that no combination of $q$ symbols, which may appear in any one of them shall be repeated in any other."
> 
> 
> 


followed by the formula:


$$\frac{n!}{q!(n-q)!)} \div \frac{p!}{q!(p-q)!}$$


Unfortunately, one finds that this formula is *false* already for small examples (e.g. $n=5, p=4, q=3$) and, indeed, reading further on that page indicates that the formula only holds in certain scenarios.


Rephrased, I am looking for an answer to Woolhouse's question for the case of $n=40, p=4, q=3$ either by a counting argument, an effective program, or a reference. Please tag/retag as appropriate; thanks!



Enumerating subsets with no triple appearing together more than once
In fact, Wikipedia article on [Steiner systems](https://en.wikipedia.org/wiki/Steiner_system) that you linked already provides an answer to your question:



> 
> An $S(3,4,n)$ is called a **Steiner quadruple system**. A necessary and sufficient condition for the existence of an $S(3,4,n)$ is that $n \equiv 2\ \text{or}\ 4 \pmod6$.
> 
> 
> 


Notice that $40\equiv 4\pmod{6}$, and so Steiner system $S(3,4,40)$ does exist. It is formed by $\frac{\tbinom{40}{3}}{\tbinom43} = 2470$ blocks (quadruples) that contain every triple *exactly* once.


Actual blocks of such a system can be seen in the La Jolla Covering Repository at [this link](https://ljcr.dmgordon.org/show_cover.php?v=40&k=4&t=3).


