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

987 B

id, challengeType, isHidden, title, forumTopicId
id challengeType isHidden title forumTopicId
5900f4ea1000cf542c50fffc 5 false Problem 381: (prime-k) factorial 302045

Description

For a prime p let S(p) = (∑(p-k)!) mod(p) for 1 ≤ k ≤ 5.

For example, if p=7, (7-1)! + (7-2)! + (7-3)! + (7-4)! + (7-5)! = 6! + 5! + 4! + 3! + 2! = 720+120+24+6+2 = 872. As 872 mod(7) = 4, S(7) = 4.

It can be verified that ∑S(p) = 480 for 5 ≤ p < 100.

Find ∑S(p) for 5 ≤ p < 108.

Instructions

Tests

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

Challenge Seed

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

euler381();

Solution

// solution required