[VA] Short & Sweet Math Challenge #22: April 1st, 2018 Spring Special
|
04-05-2018, 06:06 PM
Post: #24
|
|||
|
|||
RE: [VA] Short & Sweet Math Challenge #22: April 1st, 2018 Spring Special
It took me quite a long time to find the solution to the main course. With my limited knowledge of primality tests I was going nowhere until I took a step back, looked at the overall challenge and started to think to the date of the challenge posting, which led me to Parzival’s Easter Eggs hunt in "Ready Player One", the latest Spielberg movie. At that point I thought: "maybe Valentin has cleverly placed some clues to the solution in the numbers themselves", so I took a different look at the test numbers and bingo, each test number was an Easter egg !
Here is my 42s program for the main course. I managed to squeeze out one byte since yesterday, for a total of 36 bytes. Usage: XEQ "P", enter the test number, press R/S and see the result. 00 { 36-Byte Prgm } 01▸LBL "P" 02 CLA 03 AON 04 PROMPT 05 AOFF 06 ALENG 07▸LBL 00 08 ATOX 09 10 10 × 11 ATOX 12 + 13 528 14 - 15 XTOA 16 R↓ 17 2 18 - 19 X>0? 20 GTO 00 21 AVIEW 22 END Here is also a 48-character user function for the HP Prime: sum(CHAR(EXPR(ST(I,2))),I,1,DIM(ST),2) Usage: provide the input number as a string, e.g. SMC("8082737769637879") Note: you need first to create the variable ST (for ex. with ST:="") before defining the user function. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 12 Guest(s)