Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

nothing as it seems...

by jynx (Priest)
on Mar 27, 2001 at 04:16 UTC ( #67395=obfuscated: print w/ replies, xml ) Need Help??

#!/usr/bin/perl # This is one of my favorite algorithms, put to perl use. # Run it on command line with no arguments to see what i # mean. Feed it numbers for a bit of a spoiler. # NOTE: start with small numbers(500,1000,etc) as it's not optimized! $==$ARGV[0]||67;($j,@p)=(0,1,2);while($=>=@p-1){$h=1;{$p=$h**2+$h+$p[$ +j]; @p=b(@p,$p)if i($p);$h++;redo if $h<$p[$j]-1;}$j++}shift @p;unless(@AR +GV){ @f=@p[1,2,6,23,24,25,27];@f=($f[2]+$f[3],$f[4],$f[1]+$f[6],$f[0]+$f[5] +); $f[$_]=chr($f[$_])foreach(0..$#f);$.=join '',@f;$..=$/;die $.}foreach( +@p){ print "$_ ";print "\n" unless(++$t%10)}print "\n";sub i{($%,$*,$n)= (+shift,1,1);{($n-- and last) unless $%%$p[$*];last if $p[$*]**2>$%-1; $*++ and redo}$n}sub b{$_{$_}++ foreach(@_);sort{$a<=>$b}keys %_} #nuf evah, #jynx # # PS please tell me what you think, areas of improvement, etc...

Comment on nothing as it seems...
Download Code
Re: nothing as it seems...
by jynx (Priest) on Mar 29, 2001 at 03:54 UTC

    After much time has passed:

    i read somewhere that a japh is supposed to fit on 4 lines or less. Hmmm, i didn't know that when i first posted this. In deference to the rules, here is an updated version. The output has changed tremendously, and is now only useful if piped to a file :(

    #!/usr/local/bin/perl ($j,$a,$p,@h)=($ARGV[0]||68,-1,1,1,2);for(;$j>@h;){$==1;$a++;do{do{$;= +1;$_==$ p&&next,($*=$=**2+$=+$h[$a])%$_ or$;=0,$_**2>$*-1&&last for@h;$;}?@h=s +ort{$a <=>$b}keys%{{map{$_,1}@h,$=**2+$=+$h[$a]}}:8}while++$=<$h[$a]-1}shift@ +h;print !@ARGV?map{chr}$h[23]+$h[6],$h[24],$h[2]+$h[27],$h[1]+$h[25]:(map$_.$/ +,@h),$/
    jynx

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://67395]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-07-23 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (138 votes), past polls