[seqfan] Re: Most efficient way to construct a list of pandigital palindromic numbers?
mcneil at hku.hk
Tue Dec 8 04:47:40 CET 2009
> On 12/7/09, Alonso Del Arte <alonso.delarte at gmail.com> wrote:
>> ...enough for my purpose, which is to verify the validity of
>> A168334<http://www.research.att.com/~njas/sequences/A168334> and
>> perhaps add another four or eight terms.
Does Mma have an idiom for permutations equivalent to python iterators
which step through a loop
without constructing it?
# sage: 19-digit pandigital palindromic primes
perms = permutations_iterator(range(10))
ppps = 
for perm in perms:
nstr = ''.join(map(str, perm))
n = int(nstr + nstr[-2::-1]) # 18 dig. if initial 0; but then comp. anyway
(For the record, I find 78695 19-digit numbers.)
Department of Earth Sciences
University of Hong Kong
More information about the SeqFan