Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: Golf: Factorials

by eyepopslikeamosquito (Chancellor)
on Apr 11, 2015 at 04:49 UTC ( #1123115=note: print w/replies, xml ) Need Help??

in reply to Re^3: Golf: Factorials
in thread Golf: Factorials

Though we may have strayed a bit from the original golf, yours can be whittled by three strokes:

> perl -E "$a=1;say$a*=++$}for a..k" > perl -E "say$x*=$_ for++$x..11" 1 2 6 24 120 720 5040 40320 362880 3628800 39916800

Replies are listed 'Best First'.
Re^5: Golf: Factorials
by Discipulus (Abbot) on Dec 15, 2015 at 10:38 UTC
    yes a bit from the original post: in fact:
    perl -E "say$x*=$_ for++$x..3,0,1,-1" 1 2 6 0 # must be 1 0 # too 0 # must be undef or Error

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1123115]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2020-01-28 10:19 GMT
Find Nodes?
    Voting Booth?