in reply to Cube/digit script.
Grrrr - after I posted I finished reading japhy's post where he provided an even more succinct solution.#!/usr/bin/perl use strict; use warnings; use List::Util 'sum'; for (100 .. 999) { print "$_\n" if sum(map {$_ ** 3} split //) == $_; }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cube/digit script.
by Tanktalus (Canon) on Mar 10, 2006 at 21:35 UTC |