Your skill will accomplishwhat the force of many cannot PerlMonks

### e

by tachyon (Chancellor)
 on Jul 16, 2004 at 08:19 UTC ( #374942=obfuscated: print w/ replies, xml ) Need Help??

```sub e {
\$N=pop;\$a[\$_]=int(1+1/\$_)for 1..\$N;for(;\$N>9;print int\$x)
{for(\$n=\$N--;--\$n;\$a[\$n]=\$x%\$n,\$x=10*\$a[\$n-1]+\$x/\$n){}}
}
e(1000);

NB: Based on work by Xavier Gourdon e

cheers

tachyon

Replies are listed 'Best First'.
Re: e
by Discipulus (Parson) on Jul 16, 2004 at 10:37 UTC
good morning wise one

A part obfu that for me is very obfuscated what you are printing out ?? a suit of numbers gorwing up of a char as the argoument is > 10.
the sequence have every time the same beginning without evident internal repetitions until the argoument is < 10000 ... which kind of number is ??
which kind of number is ??

It's e

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!
```perl -e 'print exp 1'
• perldoc -f exp
• perldoc -f log
NOW I KNOW WHY I 'M GRADUATED IN MEDIAVAL HISTORY !!

cheers lorenzo*
Re: e
by I0 (Priest) on Jul 17, 2004 at 06:04 UTC
```sub e{
use integer;
my @e=(1) x shift;
for(1..@e*log(@e)/3){
for(reverse(1..\$#e)){
\$e[\$_-1]+=\$e[\$_]/\$_; \$e[\$_]%=\$_;
}
printf"%01d",\$e[0]; \$e[0]=0;
\$_*=10 for @e;
}
}

Cool. Lovely piece of code.

Map gets it down to 105 chars - yes void maps are good for golf only!

```sub e{
#234567890123456789012345678901234567890123456789012
@e=(1)x pop;map{map{\$e[\$_-1]+=\$e[\$_]/\$_;\$e[\$_]=10*(\$
e[\$_]%\$_)}reverse 1..\$#e;print int\$e[0];\$e[0]=0}1..@e
}

# or if you prefer whitespace and no void maps
sub e{
@e=(1)x pop;
for(1..@e){
for(reverse(1..\$#e)){
\$e[\$_-1]+=\$e[\$_]/\$_;
\$e[\$_]=10*(\$e[\$_]%\$_)
}
print int \$e[0];
\$e[0]=0
}
}

cheers

tachyon

Simple optimizations down to 86:

```sub e{
#234567890123456789012345678901234567890123456789012
map{\$e[\$q-1]+=\$e[\$q]/\$q,(\$e[\$q]%=\$q--).=0for
1..(\$q=@e);\$e[0]=!print"@e"|0}@e=(1)x pop
}
e(1000);

Update from tybalt89 - 80 chars:

```\$=[!print\$=]=!map{\$==\$=[\$#z]+=\$=[@z]/@z,(\$=[@z]%=1+\$#z--).=0}@z=@=for@
+==(1)x pop
Re: e
by Anonymous Monk on Jul 18, 2004 at 02:43 UTC
You're missing a period :)
Re^2: e
by I0 (Priest) on Jul 18, 2004 at 08:21 UTC
```sub e{
my @e=(1)x shift;
my \$f="%d.";
local \$|=1;
for(1..@e*log(@e)/11){
for(reverse(1..\$#e)){
\$e[\$_-1]+=\$e[\$_]/\$_;
\$e[\$_]=10000*(\$e[\$_]%\$_)
}
printf\$f,\$e[0];
\$e[0]=0;
\$f="%04d";
}
}

Create A New User
Node Status?
node history
Node Type: obfuscated [id://374942]
Approved by Corion
Front-paged by injunjoel
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (17)
As of 2016-06-30 13:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My preferred method of making French fries (chips) is in a ...

Results (395 votes). Check out past polls.