Skip to main content
1 of 2
Liam
  • 3.2k
  • 2
  • 24
  • 44

#GAP, 204 Bytes

This answer is pretty unremarkable, except that GAP is cool enough to be able to find the next couple fibohexaprimes (and cooler still, it finds these in milliseconds with the given code).

gap>f(20);                                                                    
31940434634990099905
gap> f(21);
12776523572924732586037033894655031898659556447352249
gap> f(22);
971183874599339129547649988289594072811608739584170445
gap> f(23);
1324695516964754142521850507284930515811378128425638237225
gap> f(24);
187341518601536966291015050946540312701895836604078191803255601777

Note that f(24) is between 2^216 and 2^217.

Here is the code:

f:=function(n)local c,i,x;c:=1;i:=0;while c<=n do x:=HexStringInt(Fibonacci(i));RemoveCharacters(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");x:=Int(x);if IsPrime(x) then c:=c+1;fi;i:=i+1;od;Print(Fibonacci(i-1));end;

There's probably still some golfing that could be done. I think the implementation is pretty straightforward.

Ungolfed:

f:=function(n)
    local counter,i,x;
    counter:=1;i:=0;
    while counter<=n do
        x:=HexStringInt(Fibonacci(i));
        RemoveCharacters(x,"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        x:=Int(x);
        if IsPrime(x) then
            counter:=counter+1;
        fi;
        i:=i+1;
    od;
    Print(Fibonacci(i-1));
end;
Liam
  • 3.2k
  • 2
  • 24
  • 44