Hey я'll,
A friend ["friend" from now on for anonymity they requested], is on a mission trip in Brasil right now, and cannot talk to me because of religious rules. Friend has sent me a program for the Ti-84PCE calculator that calculates pi. A masochist I am, of course want to put this on an almost-three-decades-old calculator, namely the Ti-82. If you saw my most recent post, this is specifically talking about the Ti-82 Parcus [with an optimised PCB and firmware to pair], the one that I have received in the mail today [hekin early!]. This specific model of the Ti-82 [in my sieve prime generator testing I do on my calcs], significantly outperforms the 1995 model I had first. That, is why i chose this model, so it's a little less painful to run.

Here's the program :

Code:
```1->C ClrHome Input "Total Interations",I Input "Max Value",M Disp "Estimate of π" Disp "" Disp "I=" For(A,0,1)   randInt(0,M)->F   randInt(0,M)->G   If gcd(F,G)=1 // this line isn't possible on the Ti-82   C+1->C   √(6A/C)->P   Output(4,1,P)   Output(5,3,A) End```

Here's where you's come in. I've seen what this rand(a) site on the interwebs can do. Cemetech, could you find a way to fix that line [see comment] for the Ti-82, I frankly couldn't find a way.

Thank.

Peace
--izder456
You could try implementing a gcd algorithm yourself. The Wikipedia page for GCD lists a few methods, though I don't know which would work best on a TI-82: https://en.wikipedia.org/wiki/Greatest_common_divisor#Calculation.

You might also be able to adapt this program: http://tibasicdev.wikidot.com/extended-euclidean-algorithm
commandblockguy wrote:
You could try implementing a gcd algorithm yourself. The Wikipedia page for GCD lists a few methods, though I don't know which would work best on a TI-82: https://en.wikipedia.org/wiki/Greatest_common_divisor#Calculation.
[/url]

seems like the binary one would work best, as to find an even fPart( must equal 0 when 2 is in the divisor.
I'll try that...

Thank.

Peace
--izder456

edit :
I just used the binary gcd algo and it's not working very well.
here's the code :

Code:
```1->C ClrHome Input "Total Iterations:",I Input "Max Value:",M Disp "Estimate of greek_pi" Disp "" Disp "I=" For(A,0,1)  randInt(0,M)->A  randInt(0,M)->B  // If gcd(A,B)=1  0->D  While ((fPart(A/2)=0) and (fPart(B/2)=0))   A/2->A   B/2->B   D+1->D  End  // new gcd algo  While F!=G   If (fPart(F/2)=0)   Then:F/2->A   Else:If (fPart(G/2)=0)   Then:G/2->G   Else:If F>G   Then:(F-G)/2->A   Else:(G-F)/2->B   End   End   End   F->H  End  If H*2^D=1  // end gcd algo  C+1->C  sqrt(6A/C)->P  Output(4,1,P)  Output(5,3,A) End```

commandblockguy, could you help me with this? <-- scratch that

edit 2 :
If got It working with the code for tibasicdev. Doing this, I realised that randint doesn't work on the ti-82 {see comment}

Code:
```1->C ClrHome Input "Total Iterations:",I Input "Max Value:",M Disp "Estimate of greek_pi" Disp "" Disp "I=" For(A,0,I)  int(rand(M))->F // new randInt(0,M) alt  int(rand(M))->G // ^^^  // euclidian algo  {F,G}->L1  {1,0}->L2  {0,1}->L3  1->T  While L1(dim(L1))   T+1->T   int(L1(Ans-1)/L1(Ans))->Q   L1(T-1)-Ans*L1(T->L1(T+1)   L2(T-1)-Q*L2(T->L2(T+1)   L3(T-1)-Q*L3(T->L3(T+1)  End  If L1(T)=1  // if gcd(F,G)=1  C+1->C  sqrt(6A/C)->P  Output(4,1,P)  Output(5,3,A) End```

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are GMT - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum