Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Fibonacci Sequence

by skunix (Novice)
on Feb 27, 2013 at 05:59 UTC ( #1020808=obfuscated: print w/replies, xml ) Need Help??

$~=$^=1;s//1 1 /;_:$~^=$^ ^=$~^=$^;$_.=($~=$~+$^." ");($~<99)?goto _:print

Replies are listed 'Best First'.
Re: Fibonacci Sequence
by tobyink (Abbot) on Feb 27, 2013 at 08:41 UTC

    Perhaps not especially obscure, but:


    Update: A variation, less obfuscated, but more golfy if you have a vaguely modern version of Perl...

    # 1 2 3 # 12345678901234567890123456789012345678 perl -E'$a=1;map{$.=$a+$b;$b=$a;say$a=$.}0..71'
    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
      Today I learned, $/ :D

        Still not as short as yours but here is mine revised:

        $~=$^++;_:$~^=$^ ^=$~^=$^;$_.=($~=$~+$^.$/);($~<$$)?goto _:print

      Loopy short version:

      for(++$\;$/<$$;$/=($\+=$/)-$/){print $"}

      Now can someone find a similar short expression for please?

        $"++;_:while(++$"){$"%$_||next(_)for 2..$"-1;print$",$/}

        Update: trizen has pointed out that this is more efficient:

        $"++;_:while(++$"){$"%$_||next(_)for 2..sqrt$";print$",$/}

        ... but I don't like the two extra keystrokes required. Meanwhile, this solution gives you a minor efficiency boost without any extra nasty keystroke things...

        $"++;_:while(++$"){$"%$_||next(_)for 2..$"/2;print$",$/}
        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
Re: Fibonacci Sequence
by perlaintdead (Scribe) on Mar 28, 2013 at 23:42 UTC

    did this one when i was first starting to OBFU.

    my($a,$b,$c,$r);($a,$b,$c)=f();sub t{$r=caller if eval{ord(71)};};loca +l $d="\xAA\x79\x53\x54\x44\x4f\x55\x54";"\xAA\x79"=~m/\xAA\x79/; t($&);my @z=('0','5','6','4',rand(10),'0','','3','8','4');$d=~s///;for +($i=$z[int(4+(.714287*7))];$i<125;$i=$i+5){$c=$a+=$b;$a=$b;$b=$c;__(" +\x0A");} sub __{$xz=pop;syswrite $d,"$c$xz"};sub f{return("\x30"+("\x31")*(((1- +1)+1)/(1*1)-1)-(int(48*0.020833333))), $b=(int(((ord " ")+1)*("0.0434782" ))),$c="\x5C\x78".(4+("\x2D". 1)).( +0),,,,,,,,,,,,,};

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://1020808]
Approved by Athanasius
Front-paged by Athanasius
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2018-06-19 14:45 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (114 votes). Check out past polls.