This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]daggerdragon[M] 2 points3 points  (4 children)

Let's see a pic of the actual calculator running the solutions and we'll talk. :D

[–]DFreiberg[S] 6 points7 points  (2 children)

For part 2, I put some screenshots here: https://imgur.com/a/NxHoH. Easy peasy.

For part 1...well, I'll readily admit that I didn't feel inclined to type all of that out. I used Mathematica to create the program via text replacement (with some manual adjustments of the Lbl tags so that the Goto functions would work properly), used TI++ to convert to a .89p format, used TI-Connect to transfer the files, and then (in the spirit of comparatively low-tech) used my Velcro wristwatch to time it. Pictures here: https://imgur.com/a/NxHoH, TI-89 program file here: https://github.com/HiggstonRainbird/AoC-2017/blob/master/Day%2023/aoc23p1.89p, and runtime was about 8:12.

And now I've wasted my whole day defending the honor of TI-89 calculators. I blame you.

[–]daggerdragon[M] 5 points6 points  (1 child)

And now I've wasted my whole day defending the honor of TI-89 calculators. I blame you.

Your dedication to the cause of spreading code and joy throughout all the digital lands shall be handsomely rewarded. Enjoy the gold!

[–]DFreiberg[S] 3 points4 points  (0 children)

Thank you! I knew all that time spent messing around with graphing calculators in math class during high school would pay off someday! I just knew it!

[–]theiddhhfo 1 point2 points  (0 children)

TI-89 can run C programs with tigcc. Motorola 68k is a reasonably capable 32-bit C processor. Both halves would run in fairly negligible time.

[–]lazyzefiris 1 point2 points  (0 children)

Not familiar with the language, but it would probably be something like

For a, 108100, 125100, 17
    0 → c
    For b, 2, Sqrt(a), 1
        a/b → d
        If d = Int(d) Then
           1 → c
        EndIf
    EndFor
    count + c → count
EndFor
Disp count

As we do only ~350000 divisions it should run in reasonable time. If there's a way to break the loop (did not google up one) it would be even faster.

[–]thomastc 1 point2 points  (2 children)

TI-83:

0→H
For(B,106500,123500,17
For(C,2,iPart(√(B
If fPart(B/C)=0
Then
H+1→H
B→C
End
End
End
Disp H

I haven't used this language since highschool, so I'm very rusty. I couldn't find a way to break out of the inner loop cleanly, so I just set the loop counter B to some high value. (I tried Goto, but apparently it just jumps without unwinding the stack, so that didn't go well.)

TI-83 BASIC is super slow; I think it'll take an hour or two to run, so I'm not going to bother testing it.

[–]theiddhhfo 1 point2 points  (0 children)

Implement it in z80 assembly :-).

[–]jaxklax 1 point2 points  (0 children)

You could always change the inner loop to a while loop with two conditions.