View Single Post
Old 2012-01-02, 04:04   #44
firejuggler
 
firejuggler's Avatar
 
Apr 2010
Over the rainbow

1001100001112 Posts
Default

Code:
create file graph1.txt;
write file "digraph G {";
for i=1000000 to 3,i-- do
     if isprime(i)==true then
         write ""+i+p"[shape=plaintext];"
     else
         write i+"[shape=plaintext];"
         alseq=i

         do
            sigval=sigma(i)-i
            if sigval=i then
               alseq=i+"->"+i
               write i+"[shape=circle];"
               write alseq
               exit do
           end
                  
           if sigval<1000000 then               
              if sigma(i)<i then
                 if MOD(sigval,2)==0  then write sigma(i)+[shape=triangle] end end
              alseq=alseq+"->"+sigval
              if findstring(alseq,sigval)==true then
                 write i+"[shape=circle];"
                 write sigval+"[shape=circle]"
                 write alseq
                 exit do
              end
               
              if findstring(file,sigval)==true then
                 write alseq
                 exit do
                                 
                  
                     
             end
           
            
             sigval=sigma(sigval)-i
           until isprime(sigval)==true 
           write alseq
end
write "}"
close file
now it does take care of the basic merge, amicable, cycle...
better now still haven't "implemented" boxes

Last fiddled with by firejuggler on 2012-01-02 at 04:26
firejuggler is online now   Reply With Quote