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

1001100001012 Posts
Default

pseudo-code

Code:
create file graph1.txt;
write file "digraph G {";
for i=3 to 100000 do
          if isprime(i)==true then
         write ""+i+p"[shape=plaintext];"+carriage return
     else
         write i+"[shape=plaintext];"+carriage return
         alseq=i
         do
            sigval=sigma(i)
           if sigma(i)=i then
                      alseq=i+"->"+i
                      write i+"[shape=circle];"
                      write alseq
                      exit do
           end
         if sigma(i)<i then
          if MOD(sigma(i),2)==0
             
           if sigval<1000000 then
                if isprime(sigval)==false then
                  alseq=alseq+"->"+sigval
                      if findstring(alseq,sigval(i))=true then
                                 write alseq
                                 exit do
                      end
                else
                   alseq=alseq+"->""+sigval+"p""
                   write alseq
                      exit do
                end
           else
                    write alseq
                    exit do
           end  
           until isprime(sigma(i))==true 
i=i++
end
write "}"
close file

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