0 Members and 1 Guest are viewing this topic.
{1→ʟQ{180→ʟR{60→ʟT2→IClrHome501→D"CHANGE THE ABOVE NUMBER TO CALCULATE MORE OR LESS DIGITS"?→Str1For(J,1,DOutput(1,1,Str1Output(8,1,J"ABOVE FOR TESTING3(3I+1)(3I+2→U5ʟT→L1prgmAADJUSTL1→L35ʟR→L1prgmAADJUSTL1→L2(27I-12)ʟQ→L1prgmAADJUSTL1+L2→L1prgmAADJUSTL3→L2prgmADIVIDEθ→YStr1+sub("0123456789",Y+1,1→Str1(5I-2)ʟQ→L1prgmAADJUSTL1→L2YʟT→L1prgmAADJUSTL2-L1+ʟR→L1prgmAADJUST10UL1→L1prgmAADJUSTL1→ʟR10I(2I-1)ʟQ→L1prgmAADJUSTL1→ʟQUʟT→L1prgmAADJUSTL1→ʟTI+1→IEnd
DelVar BDelVar C1→ARepeat B or A>dim(L1C+L1(A→L1(AIf not(AnsA=dim(L1)+1-sum(int(1/(1+cumSum(abs(seq(L1(Z),Z,dim(L1),1,-1→Bint(10^(7)⁻¹Ans→CIf 0>L1(A-10^(7)Ans+L1(A→L1(A10^(7)fPart(10^(7)⁻¹L1(A→L1(AA+1→AIf C and Ans>dim(L1Then0→L1(A1+dim(ʟQ→dim(ʟQAns→dim(ʟRAns→dim(ʟTAns→dim(L2Ans→dim(L3EndEnd
DelVar Gdim(L1→ARepeat G or A<1(L1(A)>L2(A))-(L1(A)<L2(A→GA-1→AEnd
DelVar θprgmACOMPAREWhile G≥0Output(6,1," Output(6,1,θ"ABOVE FOR TESTINGL1-L2→L1prgmAADJUSTθ+1→θprgmACOMPAREEnd
This sound awesome!Would you mind explaining some logic behind it / posting the Haskel program?
> piG3 = g(1,180,60,2) where> g(q,r,t,i) = let (u,y)=(3*(3*i+1)*(3*i+2),div(q*(27*i-12)+5*r)(5*t))> in y : g(10*q*i*(2*i-1),10*u*(q*(5*i-2)+r-y*t),t*u,i+1)
SetUpEditor Q,T,R{1->|LQ{60->|LT3Ans->|LRClrHome377->D"?->Str1For(J,2,D+1Output(1,1,Str1Output(6,1," Output(8,1,J-15|LT->L1prgmAADJUSTL1->L2(27J-12)|LQ+5|LR->L1prgmAADJUSTprgmADIVIDEStr1+sub("0123456789",theta+1,1->Str130((5J-2)|LQ-theta|LT+|LR->L1prgmAADJUST(3J+1)L1->L1prgmAADJUST(3J+2)L1->L1prgmAADJUSTL1->|LR10J(2J-1)|LQ->L1prgmAADJUSTL1->|LQ3(3J+1)|LT->L1prgmAADJUST(3J+2)L1->L1prgmAADJUSTL1->|LTEnd
DelVar CFor([recursiven],1,dim(L1C+L1([recursiven]->|Nint(Ans|E~7->C|N-Ans|E7->L1([recursiven]EndIf CC->L1([recursiven]dim(L1->dim(L2Ans->dim(|LQAns->dim(|LRAns->dim(|LT
1+dim(L1->ARepeat Ans or A<2A-1->A(L1(A)>L2(A))-(L1(A)<L2(AEnd
DelVar thetaprgmACOMPAREWhile Ans>=0Output(6,1," Output(6,1,thetaL1-L2->L1prgmAADJUSTtheta+1->thetaprgmACOMPAREEnd
SetUpEditor Q,T,R{1->|LQ{60->|LT3Ans->|LRClrHomeOutput(7,1,"CLEAR TO EXIT. # NEXT: 0..."?->Str12->I%Repeat getKey=45If 1<length(Str1Then" If not(fPart((length(Str1)-2)/16Output(6,1,Ans+Ans+Ans+Ans2+16int((length(Str1)-82)/16)(98<=length(Str1Output(1,1,sub(Str1,Ans,length(Str1)+1-AnsEndOutput(8,2,I%-2Output(8,12,05|LT->L1prgmAADJUSTL1->L2(9I%-4)|LQ->L1prgmAADJUST3L1+5|LR->L1prgmAADJUST0->PVprgmACOMPAREWhile Ans>=0PV+1->PVOutput(8,12,PVL1-L2->L1prgmAADJUSTprgmACOMPAREEndsub("0123456789",PV+1,1If I%=2Ans+".Str1+Ans->Str1(5I%-2)|LQ+|LR-PV|LT->L1prgmAADJUST30L1->L1prgmAADJUSTIf I%<33Then9I%^^2+9I%+2Else(3I%+1)L1->L1prgmAADJUST3I%+2EndAnsL1->L1prgmAADJUSTL1->|LR10I%|LQ->L1prgmAADJUST(2I%-1)L1->L1prgmAADJUSTL1->|LQ3|LT->L1prgmAADJUSTIf I%<33Then9I%^^2+9I%+2Else(3I%+1)L1->L1prgmAADJUST3I%+2EndAnsL1->L1prgmAADJUSTL1->|LTI%+1->I%EndClrHomesub(Str1,2,length(Str1)-1->Str1Disp "# OF DIGITS:","DIGITS STORED IN","Str1Output(1,14,I%-2
If min(L1)>0 and |E10>=max(L1Return0->PMTFor([recursiven],1,dim(L1PMT+L1([recursiven]->|Nint(|N|E~10->PMT|N-PMT|E10->L1([recursiven]EndIf not(PMTReturn[recursiven]->dim(L2Ans->dim(|LQAns->dim(|LRAns->dim(|LTPMT->L1(Ans
1+dim(L1->|NRepeat Ans or |N=1|N-1->|NL1(|N)-L2(|NEnd