Skip to main content
2 of 8
added 93 characters in body

##C, 186 bytes

#include<stdint.h>
typedef uint64_t u;u F(n){u a=0,b=1,x;while(n){x=b;b+=a;a=x;u d,c=0,m=1;while(x)d=x%16,m*=d<10?c+=m*d,10:1,x/=16;d=c>1;x=2;while(x<c)if(c%x++==0)d=0;d&&--n;}return a;}

The primality test is very inefficient, so the computation will struggle a bit for n > 16 and become painfully long for n = 19. Nevertheless it works and gives the expected results.

Test main:

#include <stdio.h>

int main() {
  printf("Input - Output\n");
  for (int i = 1; i < 20; ++i) {
    printf("%2d    - %ld\n", i, F(i));
  }
}