Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 (Monsignor) 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.

      Chady | http://chady.net/
      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

      Re^3: e
      by mtve (Deacon) on Jul 17, 2004 at 09:36 UTC

        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^4: e
        by shmem (Chancellor) on Sep 13, 2015 at 09:47 UTC
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"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://374942]
Approved by Corion
Front-paged by injunjoel
help
Chatterbox?
[usemodperl]: just answer my question without judging me or my technique, if that's possible around here anymore, sheesh
[Corion]: usemodperl: You should be well aware of the ways to make your approach still work, even if it is to set up your own proxy that strips HTTPS. It shouldn't be hard for somebody with your acumen.
[Corion]: Unless you just want to vent your frustration about how others don't provide for your whims. That's sometimes necessary. There, there.
[usemodperl]: so to answer my question, no http at cpan, and all rationalized too, thanks
[marto]: this 'safe space' thing you have going on seems just like wanting to whine without anyone replying
[Corion]: usemodperl: Naah, if you scroll back, you'll find several approaches that still work. Maybe a prewrapped solution like CPAN::Mini is what you want. Or maybe App::FatPacker. But you don't seem to want to listen. That's OK.
[Corion]: There, there. It'll all be better.
[marto]: usemodperl "so to answer my question, no http at cpan," doesn't tie up with what you said "I can find cpan mirrors on http"
[usemodperl]: yea but http only has tar.gz, i wanna download modules with core perl, but http seems to make it impossible, that's my only question, how to find http mirrors like meta, or how to do it with core perl, but options now seem totally broken (on purpose :-(

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2018-06-24 16:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?