69 lines
1.1 KiB
Markdown
69 lines
1.1 KiB
Markdown
![]() |
---
|
||
|
id: 5
|
||
|
localeTitle: 5900f4c21000cf542c50ffd4
|
||
|
challengeType: 5
|
||
|
title: 'Problem 340: Crazy Function'
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
<section id='description'>
|
||
|
Para los enteros fijos a, b, c, defina la función loca F (n) de la siguiente manera:
|
||
|
F (n) = n - c para todos n> b
|
||
|
F (n) = F (a + F (a + F) (a + F (a + n)))) para todos n ≤ b.
|
||
|
|
||
|
|
||
|
También, defina S (a, b, c) =.
|
||
|
|
||
|
|
||
|
Por ejemplo, si a = 50, b = 2000 y c = 40, entonces F (0) = 3240 y F (2000) = 2040.
|
||
|
Además, S (50, 2000, 40) = 5204240.
|
||
|
|
||
|
|
||
|
Encuentra los últimos 9 dígitos de S (217, 721, 127).
|
||
|
</section>
|
||
|
|
||
|
## Instructions
|
||
|
<section id='instructions'>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
tests:
|
||
|
- text: <code>euler340()</code> debe devolver 291504964.
|
||
|
testString: 'assert.strictEqual(euler340(), 291504964, "<code>euler340()</code> should return 291504964.");'
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='js-seed'>
|
||
|
|
||
|
```js
|
||
|
function euler340() {
|
||
|
// Good luck!
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
euler340();
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|
||
|
</section>
|