fix-math
Build / build (push) Failing after 14m29s

This commit is contained in:
2026-07-29 18:15:35 -04:00
parent 5ed08ed8ef
commit c41ae4da75
+7 -2
View File
@@ -12,6 +12,7 @@ If we list all the natural numbers below $10$ that are multiples of $3$ or $5$,
Suppose the base numbers were $2$ and $3$ below $10$ so $9$, they would create duplicates, ie $6$ is counted twice. Therefore take the sum of each multiple to the limit, and one time remove the numbers counted twice:
#html.frame(
$
&2+4+6+8+3+cancel(6)+9 = 32\
&sum_(i=1)^(floor(9/(2)))2i + sum_(i=1)^(floor(9/(3))) 3i - sum_(i=1)^(floor(9/(6))) 6i \
@@ -20,15 +21,17 @@ $
= 2& (4(5))/2 + 3 (3(4))/2 - 6 (1(2))/2\
= 3&2
$
)
This revealed a general solution, for base numbers $n, m$ below $L$:
#html.frame(
$
f(n,m,L) =&n sum_(i=1)^floor((L-1)/n) i + m sum_(i=1)^floor((L-1)/m) i- n m sum_(i=1)^floor((L-1)/(n m))i \
"Define "&a = floor((L-1)/n), b = floor((L-1)/m), c = floor((L-1)/(n m)) \
=> f(n,m,L) =& (n a(a+1) + m b(b+1) - n m (c)(c+1))/2
$
)
Testing this as code:
```py
@@ -61,6 +64,8 @@ The goal is to not add the number if it was already added.
Mathamatically this can be done piecewise. If a previous element of $A$ divides $A_i k$, skip that number.
#html.frame(
$
f(A, L) = sum_(i)^abs(A)[sum_(k=1)^floor((L-1)/A_i) cases(0 quad & A_j divides A_i k and j < k, A_i k quad & A_j divides.not A_i k and j < k)]
$
$
)