I liked it, I found the loops not as easy to write as I expected thank you !
I got stuck a while with the bigInt test until I understood I needed a bigInt. In javascript there is no error and the number calculated by my code was truncated but really close to the expected answer (only 95 of difference). It was funny to figure it out.
I agree with the others, it may be difficult for beginners to think of that, especially depending on the language.
The problem is that it’s a validator (12 for me) which is not working with a classic code in php…It can be hard to guess that it’s a problem with large numbers. Should be a good thing to swap validator 12 and test 12 no ?
For test 7:
_At T0: nb of pairs = 8
_At T1: nb of pairs = 8
_At T2: nb of pairs = 8
_At T3: nb of pairs = 8
_At T4: nb of pairs = 16 (2T3)
_At T5: nb of pairs = 32 (2T4)
_At T6: nb of pairs = 24 (T1+T2+T3)
_At T7: nb of pairs = 32 (T2+T3+T4)
_At T8: nb of pairs = 56 (T3+T4+T5)
_At T9: nb of pairs = 72 (T4+T5+T6)
_At T10: nb of pairs = 88 (T5+T6+T7)
_At T11: nb of pairs = 112 (T6+T7+T8)
_At T12: nb of pairs = 160 (T7+T8+T9)
Seeing the comments here I realised I set the maximum to be under 2^64 so it could be done in every languages, I didn’t know there was no unsigned in some language, if it’s not too late to change that now that it is published I’ll edit that because even if there was the fact that the issue only occur on a validator is no good.
It’s no big deal, javascript can have numbers up to 2^1024, you’re not the first one I see telling that but you have not any problem with overflows in js, I’m no expert but I’m pretty sure js only has the type “number” for floats and ints and it can go way higher than 2^53, it’s not even like you had to specify you want a big number. No issue there
Well I realise I said something really wrong, it must have been too long since I last did Js, you can overcome the 2^53-1 limit by using BigInt. Something like the following will print the exact good answer:
const num = BigInt(2**64);
console.log(num.toString());
// Output : 18446744073709551616
Thank you for your help. But, for Tests 1 to 6, we have to output the n-th element of the Fibonacci suite, and simply the n-th element itself, that is F[N] very simply. But only for Test 7, we have to compute the difference between F[N] and F[N - a + 1] to get the New Borns only. And for Test 8, another type of computation.
This makes impossible for a unique code to match all the cases.