With all the prime number fun going on over here, now seems a good chance to dust off and present an obfuscation that just needed a little polishing up.

Given a positive integer argument, this program will display all of its prime factors.

$;=pop;{$.= 0;map{$;%$_ or$.||=$_}2 ..sqrt$;;;+ $.||die$;-j .$/;warn$.. $/;$;/=$.;n until+redo}


Replies are listed 'Best First'.
Re: Prime Time for an Obfuscation
by wulvrine (Friar) on Apr 16, 2007 at 12:24 UTC
    Great job!! ++
    Fun to play with putting in numbers like birthdays etc lol :)
    As always, you are the master of obfu's

    s&&VALKYRIE &&& print $_^q|!4 =+;' *|
Re: Prime Time for an Obfuscation
by Ray Smith (Beadle) on Apr 16, 2007 at 12:22 UTC
    Nice job - as usual!
Re: Prime Time for an Obfuscation
by Anonymous Monk on Jul 29, 2007 at 23:49 UTC
    Did someone have trouble running it against this number: 1234567890123111? 5.8.8 on MSWin32

      It tries to create a list containing 2..sqrt(1234567890123111). So it starts to allocate 33.5M entries, taking a long time to spin as much RAM into place as it can, before it (I presume) dies (having caused way too much other stuff to swap out). Is that what you mean by "problem"? :)

      - tye