Iccanobif primes
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.
Iccanobif primes are prime numbers that, when reversed, are a Fibonacci number.
- 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)) ~ " (digits: {.chars})" }
say (++$).fmt('%2d') ~ ': ' ~ .&abbr for (lazy (1,1,*+*…*).hyper.grep: {.flip.is-prime})[^25];
- Output:
1: 2 (digits: 1) 2: 3 (digits: 1) 3: 5 (digits: 1) 4: 13 (digits: 2) 5: 34 (digits: 2) 6: 377 (digits: 3) 7: 1597 (digits: 4) 8: 10946 (digits: 5) 9: 75025 (digits: 5) 10: 121393 (digits: 6) 11: 17167680177565 (digits: 14) 12: 135301852344706746049 (digits: 21) 13: 1672445759041379840132227567949787325 (digits: 37) 14: 3691087032412706639440686994833808526209 (digits: 40) 15: 30464466237021013443..96920321847653300991 (digits: 80) 16: 32913358638779021325..58997476926373114877 (digits: 104) 17: 13165703827079947192..88140676510958522773 (digits: 137) 18: 16750341744683276705..59513167849839163757 (digits: 330) 19: 31953053259600357131..02673823374863309871 (digits: 406) 20: 70520374065886416072..50351192710136172329 (digits: 409) 21: 18441226374242153376..35265089601875102405 (digits: 503) 22: 10281003316385169296..29008393747421011503 (digits: 888) 23: 12365854644134546680..55549639624074581864 (digits: 1020) 24: 19372256889969382102..48891873035874310178 (digits: 1122) 25: 16425634816734200102..63356734522065615471 (digits: 1911)