From a881f7518d1c02092c6f8700222ebf129f2a650c Mon Sep 17 00:00:00 2001 From: filifa Date: Sat, 19 Apr 2025 20:42:09 -0400 Subject: [PATCH] use a sage function for polygonal numbers --- notebooks/problem0012.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/problem0012.ipynb b/notebooks/problem0012.ipynb index 970f9eb..e3c0055 100644 --- a/notebooks/problem0012.ipynb +++ b/notebooks/problem0012.ipynb @@ -7,7 +7,7 @@ "source": [ "# [Highly Divisible Triangular Number](https://projecteuler.net/problem=12)\n", "\n", - "Yet another problem with a straightforward solution thanks to SageMath's preinstalled functions. We'll also once again apply the closed formula for triangle numbers (see [problem 1](https://projecteuler.net/problem=1))." + "Yet another problem with a straightforward solution thanks to SageMath's preinstalled functions. Triangular numbers fall into the broader category of [polygonal numbers](https://en.wikipedia.org/wiki/Polygonal_number)." ] }, { @@ -26,7 +26,7 @@ ], "source": [ "for n in PositiveIntegers():\n", - " t = n * (n+1) / 2\n", + " t = polygonal_number(3, n)\n", " if number_of_divisors(t) > 500:\n", " print(t)\n", " break"