Post Reply 
[VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math"
02-18-2021, 11:23 PM (This post was last modified: 02-19-2021 10:23 PM by Gerson W. Barbosa.)
Post: #17
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math...
(02-18-2021 01:41 PM)Gerson W. Barbosa Wrote:  Perhaps 19 or less would suffice as the argument for the first program...

Indeed 19 is enough:

19

« { } 1 DUP2 ROT 5 ROLL
START NEXTPRIME + LASTARG NIP
NEXT DROP SQ DUP SIZE 2 SWAP
FOR i 1 OVER SIZE 1 + i -
FOR j DUP j DUP i + 1 - SUB ∑LIST ROT + SWAP
NEXT
NEXT + SORT
»

EVAL

« REVLIST 1 99
START TAIL
NEXT SORT
»

EVAL



{ 4 9 13 25 34 38 49 74 83 87 121 169 170 195 204 208 289 290 339 361 364 373 377 458 529 579 628 650 653 662 666 819 841 890 940 961 989 1014 1023 1027 1179 1348 1369 1370 1469 1518 1543 1552 1556 1681 1731 1802 1849 2020 2189 2209 2310 2330 2331 2359 2384 2393 2397 2692 2809 2981 3050 3150 3171 3271 3320 3345 3354 3358 3481 3530 3700 3721 4011 4058 4061 4350 4489 4519 4640 4689 4714 4723 4727 4852 4899 }



P. S.:

2020 is in the list because 2020 = 17² + 19² + 23² + 29². In fact every number in the list is either a squared prime or the sum of an ordered sequence thereof.

The number of consecutive prime squares starting with 4 (2²) required to safely producing a list of all years that share this property, up to a certain year, can be mathematically determined, but that’s way beyond my math skills. The following program uses a borrowed formula.

5000

« DUPDUP 4 * SWAP LN SQ / 3 XROOT 3 * CEIL { } 1 DUP2 ROT 5 ROLL
START NEXTPRIME + LASTARG NIP
NEXT DROP SQ DUP SIZE 2 SWAP
FOR i 1 OVER SIZE 1 + i -
FOR j DUP j DUP i + 1 - SUB ∑LIST ROT + SWAP
NEXT
NEXT + SORT REVLIST
WHILE DUP HEAD PICK3 >
REPEAT TAIL
END REVLIST NIP
»

EVAL

Checksum: # 180Ch
Length: 213.5 bytes

This will return a list with 91 elements, same as above.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenge #25 "San Valentin's Special: Weird Math... - Gerson W. Barbosa - 02-18-2021 11:23 PM



User(s) browsing this thread: 1 Guest(s)