I have created a program to generate the first N cyclotomic polynomials. The point of this was to test a remark I read on Wikipedia, that 105 is the first number whose cyclotomic polynomial contains a non -1, 0, 1 digit. Unfortunately my calc can't hold all the lists necessary, so I had to make do with in the 50's. Another problem with the program is that it is necessary to repeatedly recall Ans, delete the quotes, and press enter again. Maybe there is some way to do it without using customized lists?
The necessary program is prgmO (sp.?), here.
Code: :SetUpEditorL001
:If not(dim(∟L001
:Then
:Prompt N
:"
:For(C,1,N
:Ans+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"+1"+Str2+"dim(∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+":
:End
:sub(Ans,2,length(Ans)-1)+"prgmO
:Return
:End
:If ∟L001(1)=0
:Then
:"
:For(C,1,N
:Ans+"1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"(1):‾1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)+"("+sub("0123456789",int((C+1)/100)+1,1)+sub("0123456789",10fPart((C+1)/100)-fPart((C+1)/10)+1,1)+sub("0123456789",10fPart((C+1)/10)+1,1)+"):
:End
:sub(Ans,2,length(Ans)-1)+"prgmO→Str1
:2→C
:Return
:End
:If C>N
:Then
:DelVar L1DelVar L2DelVar L3Disp "DONE!
:Stop
:End
:"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)
:expr(Ans)→L1
:For(D,1,C-1)
:If not(fPart(C/D
:Then
:"∟L"+sub("0123456789",int(D/100)+1,1)+sub("0123456789",10fPart(D/100)-fPart(D/10)+1,1)+sub("0123456789",10fPart(D/10)+1,1)
:expr(Ans)→L2
:dim(L1)-dim(L2)+1→dim(L3
:dim(L1→dim(L2
:For(E,1,dim(L3
:L1(E)
:For(X,2,E
:Ans-L2(X)L3(E+1-X
:End
:Ans/L2(1)→L3(E
:End
:dim(L1)-dim(L3)+1→dim(L2
:L3→L1
:End
:End
:"L1"+Str2+"∟L"+sub("0123456789",int(C/100)+1,1)+sub("0123456789",10fPart(C/100)-fPart(C/10)+1,1)+sub("0123456789",10fPart(C/10)+1,1)
:If C=N:Ans+":Clear Entries
:Ans+":prgmO"→Str1
:C+1→C
:Return
Here is prgmOPENME, the training program:
Code: :ClrHome
:Disp "FIRST THING TO","DO IS TO READ","ALL THESE IN-","STRUCTIONS. THEN","OPEN prgmO."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "N IS THE NUMBER","YOU WANT TO GO","TO. WHEN THE","PROGRAM SAYS","DONE, PRESS 2ND,","STO"+Str2+", 2ND, Ans."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "Then PRESS ENTER","ERASE THE QUOTES","AROUND IT THEN","HIT ENTER AGAIN.","TRY THAT NOW."
:Repeat Str5="GOOD
:"GOOD
:Input "",Str5
:If Str5≠"GOOD
:Disp "TRY AGAIN."
:End
:DelVar Str5ClrHome
:Disp "NICE. NEXT, WHEN","IT SAYS DONE","AGAIN, PRESS 2ND","STO"+Str2+", VARS, 7,1."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "THEN REMOVE THE","QUOTES FROM","AROUND IT. THERE","ARE NONE HERE."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "TRY THIS NOW."
:Repeat Str5="WELL DONE
:"WELL DONE"→Str1
:Input "",Str5
:If Str5≠"WELL DONE"
:Disp "TRY AGAIN."
:End
:ClrHome
:Disp "GREAT! NOW KEEP","REPEATING THIS","STEP UNTIL IT","SAYS DONE! WITH","A ! AT THE END."
:Output(8,1,"PRESS ENTER NOW."
:Pause
:ClrHome
:Disp "TRY IT NOW."
:For(C,1,5
:sub("COOLNICEGOODOKAYFINE",4C-3,4→Str1
:Input "",Str5
:If Str5≠sub("COOLNICEGOODOKAYFINE",4C-3,4
:Then
:0→C
:Disp "TRY AGAIN."
:End
:End
:DelVar Str5
:Disp "DONE!
Str2 contains →, just the store arrow.
Here's the group all contained in one file. How can I make it so that I don't have to keep recalling Ans?
Last edited by Guest on 15 Aug 2009 06:29:15 pm; edited 1 time in total |