freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-403-lattice-points-enclosed-by-parabola-and-line.english.md
mrugesh 22afc2a0ca feat(learn): python certification projects (#38216)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
2020-05-27 13:19:08 +05:30

1.2 KiB

id, challengeType, isHidden, title, forumTopicId
id challengeType isHidden title forumTopicId
5900f5001000cf542c510013 5 false Problem 403: Lattice points enclosed by parabola and line 302071

Description

For integers a and b, we define D(a, b) as the domain enclosed by the parabola y = x2 and the line y = a·x + b:D(a, b) = { (x, y) | x2 ≤ y ≤ a·x + b }.

L(a, b) is defined as the number of lattice points contained in D(a, b). For example, L(1, 2) = 8 and L(2, -1) = 1.

We also define S(N) as the sum of L(a, b) for all the pairs (a, b) such that the area of D(a, b) is a rational number and |a|,|b| ≤ N. We can verify that S(5) = 344 and S(100) = 26709528.

Find S(1012). Give your answer mod 108.

Instructions

Tests

tests:
  - text: <code>euler403()</code> should return 18224771.
    testString: assert.strictEqual(euler403(), 18224771);

Challenge Seed

function euler403() {
  // Good luck!
  return true;
}

euler403();

Solution

// solution required