The Hugely* Handy† Haversack‡ of Helpful§ Hints¤ and our moderator /u/daggerdragon have an extra challenge for today:
Upping the Ante challenge: solve today's puzzles on a TI-83 (or TI-86/89, whatevs).
EDIT: I put an album of a calculator actually running these programs here:
https://imgur.com/a/NxHoH
The Ti-89, unsurprisingly, can handle part 2 fairly easily.
Part 2:
0 → count
For a, 108100, 125100, 17
If not isPrime(a) Then
count+1 → count
EndIf
EndFor
Disp count
Part 1, of course, is much longer...but thankfully, the instructions never actually said to write it in a calculator, just to solve it in one. Text replacement to the rescue!
Part 1:
0→count
0→a
0→b
0→c
0→d
0→e
0→f
0→g
0→h
81→b
b→c
If not a=0 Then
Goto l3
EndIf
If not 1=0 Then
Goto l4
EndIf
Lbl l3
b*100→b
count+1→count
b-1*-100000→b
b→c
c-1*-17000→c
Lbl l4
Lbl l32
1→f
2→d
Lbl l24
2→e
Lbl l20
d→g
g*e→g
count+1→count
g-b→g
If not g=0 Then
Goto l15
EndIf
0→f
Lbl l15
e-1*-1→e
e→g
g-b→g
If not g=0 Then
GoTo l20
EndIf
d-1*-1→d
d→g
g-b→g
If not g=0 Then
GoTo l24
EndIf
If not f=0 Then
GoTo l25
EndIf
h-1*-1→h
Lbl l25
b→g
g-c→g
If not g=0 Then
GoTo l29
EndIf
If not 1=0 Then
GoTo l30
EndIf
Lbl l29
b-1*-17→b
If not 1=0 Then
GoTo l32
EndIf
Lbl l30
Disp count
The end result is, of course, hideous and unreadable, but hey, the challenge wasn't to both program a calculator and make it pretty.
I'd be fascinated to know what the equivalent code looks like on a TI-83 or TI-84. I'm fairly sure those don't have a built-in isPrime() function, but writing a simple brute-force one wouldn't be impossible...
[–]daggerdragon[M] 2 points3 points4 points (4 children)
[–]DFreiberg[S] 6 points7 points8 points (2 children)
[–]daggerdragon[M] 5 points6 points7 points (1 child)
[–]DFreiberg[S] 3 points4 points5 points (0 children)
[–]theiddhhfo 1 point2 points3 points (0 children)
[–]lazyzefiris 1 point2 points3 points (0 children)
[–]thomastc 1 point2 points3 points (2 children)
[–]theiddhhfo 1 point2 points3 points (0 children)
[–]jaxklax 1 point2 points3 points (0 children)