Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-340-crazy-function.english.md
Randell Dawson a7eb800450 fix(curriculum): Remove unnecessary assert message argument from English Coding Interview Prep challenges - Project Euler - 04 (#36418)
* fix: removed assert msg argument-4

* fix: remove double quotes surrounding testString code

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
2019-07-27 07:34:19 -05:00

978 B

id, challengeType, title
id challengeType title
5900f4c21000cf542c50ffd4 5 Problem 340: Crazy Function

Description

For fixed integers a, b, c, define the crazy function F(n) as follows: F(n) = n - c for all n > b F(n) = F(a + F(a + F(a + F(a + n)))) for all n ≤ b.

Also, define S(a, b, c) = .

For example, if a = 50, b = 2000 and c = 40, then F(0) = 3240 and F(2000) = 2040. Also, S(50, 2000, 40) = 5204240.

Find the last 9 digits of S(217, 721, 127).

Instructions

Tests

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

Challenge Seed

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

euler340();

Solution

// solution required