Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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...

Replies are listed 'Best First'.
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?
[stevieb]: choroba my GPS home device is done, at least prototype v1 is. I'm just making sure all of my code does what it says now
[stevieb]: I test/prototype code on my Pi, then I migrate it over to Arduino when it's ready (if that's a better platform for what I'm doing). The whole RPi stuff was for learning at first, then it snowballed. I'm just trying to get my in-house CI...
[stevieb]: ...done, which obviously requires a specific hardware setup.
[stevieb]: I don't write tests for the lower-level distributions (ie. ICs, sensors etc) within those distributions, I have all tests in a master distribution which encompasess all of the sub-modules

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-06-25 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.