Iccanobif primes
Iccanobif primes are prime numbers that, when reversed, are a Fibonacci number.
Iccanobif primes is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
- Find and display the first 10 iccanobif primes.
- Stretch
- Find and display the digit count of the next 15 iccanobif primes.
- See also
Raku
sub abbr ($_) { .chars < 41 ?? $_ !! .substr(0,20) ~ '..' ~ .substr(*-20) ~ " ({.chars} digits)" }
say (++$).fmt('%2d') ~ ': ' ~ .&abbr for (lazy (1,1,*+*…*).hyper.grep: {.flip.is-prime})[^25];
- Output:
1: 2 2: 3 3: 5 4: 13 5: 34 6: 377 7: 1597 8: 10946 9: 75025 10: 121393 11: 17167680177565 12: 135301852344706746049 13: 1672445759041379840132227567949787325 14: 3691087032412706639440686994833808526209 15: 30464466237021013443..96920321847653300991 (80 digits) 16: 32913358638779021325..58997476926373114877 (104 digits) 17: 13165703827079947192..88140676510958522773 (137 digits) 18: 16750341744683276705..59513167849839163757 (330 digits) 19: 31953053259600357131..02673823374863309871 (406 digits) 20: 70520374065886416072..50351192710136172329 (409 digits) 21: 18441226374242153376..35265089601875102405 (503 digits) 22: 10281003316385169296..29008393747421011503 (888 digits) 23: 12365854644134546680..55549639624074581864 (1020 digits) 24: 19372256889969382102..48891873035874310178 (1122 digits) 25: 16425634816734200102..63356734522065615471 (1911 digits)