Re: Re: SuperPrimes
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg668] Re: [mg632] Re: [mg622] SuperPrimes
- From: Roman Maeder <maeder at inf.ethz.ch>
- Date: Sat, 08 Apr 1995 11:37:13 +0200
villegas at wri.com (Robert Villegas) writes: > My induction step is pretty much a brute-force search of possibilities. > Maybe some number theory knowledge could be brought to bear on this > for a much better overall method. > > > Here's an implementation of this approach: > > > superPrime[n_] := > Nest[Flatten[#, 1]& @ Map[Select[10 # + {1, 3, 5, 7, 9}, PrimeQ]&, #] &, > {2, 3, 5, 7}, n - 1] some number theory knowledge can indeed be applied: a prime can never end in a 5 (unless it's the only digit), so you can delete that case from the iteration: superPrime[n_] := Nest[Flatten[#, 1]& @ Map[Select[10 # + {1, 3, 7, 9}, PrimeQ]&, #] &, {2, 3, 5, 7}, n - 1] Roman Maeder