From c41ae4da75a048f44b5bb4b8f57e6cc391c8fbcc Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 29 Jul 2026 18:15:35 -0400 Subject: [PATCH] fix-math --- static/posts/pe-p1/post.typ | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/posts/pe-p1/post.typ b/static/posts/pe-p1/post.typ index 452c1b1..1100de9 100644 --- a/static/posts/pe-p1/post.typ +++ b/static/posts/pe-p1/post.typ @@ -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)] -$ \ No newline at end of file +$ +) \ No newline at end of file