in reply to Symmetrical Numbers (GOLF)
which produces:#!/usr/bin/perl -w my $ref = sym(10000); for my $key (sort {$a <=> $b} keys %$ref) { printf "%-10d%d\n",$key,$ref->{$key}; } sub sym { for(1..shift) { sub s{$_[0]==join"",reverse split//,$_[0]} if(&s($_)&&&s($_**2)){$s{$_}=$_**2} } \%s; }
i'm quite pleased, for my first golf attempt, at1 1 2 4 3 9 11 121 22 484 101 10201 111 12321 121 14641 202 40804 212 44944 1001 1002001 1111 1234321 2002 4008004
~Particle
nevermind the xp, remember the experience.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Symetrical Numbers (GOLF)
by particle (Vicar) on Jul 12, 2001 at 00:08 UTC | |
|
Re: Re: Symetrical Numbers (GOLF)
by tachyon (Chancellor) on Jul 11, 2001 at 23:43 UTC |