Little explorations with HP calculators (no Prime)

12272018, 03:22 PM
Post: #318




RE: Little explorations with HP calculators (no Prime)
To explore this, I put together a couple of helper apps.
The first simply creates a randomized list of 1s (blue balls) and 0s (white balls): Code: Balls "Balls" creates a randomized list of 100 1s and 40 0s in about 0.1s. To see how many contiguous runs of 50 blue/20 white "balls" there were in a list, I created this routine: Code: AnnaBerta "AnnaBerta" takes the list created by "Balls" and checks each contiguous subgroup of 70 elements for the proper mixture of blue/white elements. I assumed that no wraparound is appropriate for contiguous groups, so I only check starting positions of 171. The smallest result I recall seeing was 1, ie. a single contiguous group in the target list. The largest would be 71, since it's possible to come up with an ordered list where all contiguous subgroups meet the criteria. I've yet to see that in random testing, though. Execution time of "AnnaBerta" varies depending on the number of found starting points. A list with only 1 "match" completes in about 2.4s, and the opposite extreme (71 matches) completes in about 3.1s. 

« Next Oldest  Next Newest »

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