Determine theoretical max connections for MariaDB
Every formula I have found is wrong in some respect.  Almost every computer I have encountered has &quot;overcommitted&quot; RAM; that is, the formula would say that too much RAM could be used.
Their list is missing two important settings:  max_heap_table_size and tmp_table_size.  The min of those two is what is used for internal temp tables in complex SELECTs.  And there could be multiple uses in a single query!  I recommend limiting each to 1% of RAM.
Overall...

Leave most VARIABLES at the defaults.
The 1% mentioned above
use InnoDB, not MyISAM.
Set key_buffer_size to just 20M.
Set innodb_buffer_pool_size to about 70% of available RAM if you have more than 4GB of RAM.  (A lower percentage for tiny machines.)  This is the first thing to reach for if swapping occurs.
When you find problems (swapping, high cpu, high I/O, etc), ask for help.  It will usually be solved by better INDEXing and/or reformulating queries, not by tuning.

Ignore the formulas like what your question is posing.
As for &quot;too many connections&quot;, there are two main causes and tuning MySQL/MariaDB is not the cure.

The queries are running so slowly that they need help -- tuning queries is a solution here.
The clients are flooding the database.  Some web servers think that they can efficiently run hundreds or thousands of threads.  But, in reality, they stumble over themselves and cause the database to also stumble over itself.  Throttle them.

On this last bullet item, think of a grocery store where so many shoppers are in there that they can't even push their carts to the next aisle, much less ever get finished.
Put another way, if you let too many connections in, throughput stalls (hits some limit) and latency suffers badly.
Things to watch for:

Swapping means things are tuned too high -- discussed above
100% CPU or I/O -- Fine and fix the queries.  For help in finding them:  http://mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog
Poor latency (queries taking &quot;too long&quot;) -- See the other two items.