Maybe there is a way to translate this Haskell version to D with bigints: http://rosettacode.org/wiki/Find_largest_left_truncatable_prime_in_a_given_base#Haskell Unrelated: now I have a kind of efficient longest common subsequence algorithm with O(n) memory usage. Maybe there is some interest for it in Phobos. Bye, bearophile