oeis.org

A034289 - OEIS

(Perl)

#!/usr/bin/perl

# change this to compute more terms:

$max_digits = 5;

# put the squares into a hash table; for example

# 46 -> 64

# 144 -> 144 441

# 169 -> 169 196 961

$max_i = sqrt(10 ** $max_digits);

for $i (1..$max_i)

{

$i_sq = $i * $i;

$normalized = join('', sort(split(//, "$i_sq")));

$sq_hash{"$normalized"} .= "$i_sq ";

}

# find the hash entries with more than one square

foreach (values(%sq_hash)) { $nums .= $_ if (/ \d/); }

# print the numbers in order

print join(' ', sort( { $a <=> $b } split(' ', "$nums")));

# Jonathan Cross (jcross(AT)juggler.net), Oct 18 2003