From 69eb5748a9c01f7e2515329306405b541271f057 Mon Sep 17 00:00:00 2001 From: Jonathan Chan Date: Thu, 1 Dec 2016 00:57:25 -0800 Subject: [PATCH] Problem 28 --- 27.txt | 13 ------------- 28.txt | 10 ++++++++++ 2 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 27.txt create mode 100644 28.txt diff --git a/27.txt b/27.txt deleted file mode 100644 index 27d2950..0000000 --- a/27.txt +++ /dev/null @@ -1,13 +0,0 @@ -Euler discovered the remarkable quadratic formula: - -n^2+n+41 - -It turns out that the formula will produce 40 primes for the consecutive integer values 0≤n≤39. However, when n=40,40^2+40+41=40(40+1)+41 is divisible by 41, and certainly when n=41,41^2+41+4 is clearly divisible by 41. - -The incredible formula n^2−79n+1601 was discovered, which produces 80 primes for the consecutive values 0≤n≤79. The product of the coefficients, −79 and 1601, is −126479. - -Considering quadratics of the form: - -n^2+an+b, where |a|<1000 and |b|≤1000 - -Find the product of the coefficients, a and b, for the quadratic expression that produces the maximum number of primes for consecutive values of n, starting with n=0. diff --git a/28.txt b/28.txt new file mode 100644 index 0000000..ad54f70 --- /dev/null +++ b/28.txt @@ -0,0 +1,10 @@ +Upper-right: (2n-1)² +Upper-left : (2n-1)² - (2n-2) +Lower-left : (2n-1)² - 2(2n-2) +Lower-right: (2n-1)² - 3(2n-2) + +Total (nth spiral): 4(2n-1)² - 6(2n-2) +Spirals: ceiling(1001/2) = 501 +Sum_{n=2}^{n=501} 16n²-28n+16 = 669 171 000 + +Answer = 669171001