isProbablePrime(i) introduces additional time complexity, probability that a number is prime is 1-pow(0.5, i). Even for small i~30 it is almost 1 so it's pointless to pass such big values here.

The current code always tests every number from 0 to 999, even if the list has only 5 elements. It also can't find the smallest unused ID if it's bigger than 999.

Yep, that's what I figured out at some point, see two solutions bellow.

This is not correct. Consider the case:

You could use normal recursion instead of the tail recursion, that way you wouldn't need the extra argument.

But this works nice anyways ;)

introduces additional time complexity, probability that a number is prime is 1-pow(0.5, i). Even for small i~30 it is almost 1 so it's pointless to pass such big values here.isProbablePrime(i)This comment is hidden because it contains spoiler information about the solution

You may want to use:

The current code always tests every number from 0 to 999, even if the list has only 5 elements. It also can't find the smallest unused ID if it's bigger than 999.

Hello, could you tell me for how long have you been working with Python? Your solution seems to advance.

great solution

Ok, i'll add it soon)

Looks better, thanks.

I'd suggest including a set of random tests as well.

I forked it

https://www.codewars.com/kumite/5aec183a252e66cb790000e8?sel=5ec2d2092b16bb001e7d32cd

This comment is hidden because it contains spoiler information about the solution

Awesome example of helping me understand how/when to use flatMap !!

This comment is hidden because it contains spoiler information about the solution

## Loading more items...