Truncatable primes: Difference between revisions
Content deleted Content added
m →{{header|CoffeeScript}}: fix end tag |
→{{header|CoffeeScript}}: bug fix |
||
Line 354:
else
left = Math.floor n / 10
right = n % 10▼
while left > 0
left = max_right_truncatable_number left, f
while right > 0
candidate = left * 10 + right
return candidate if candidate <= n and f(candidate)
right -= 1
left -= 1
throw Error "none found"
|