Little explorations with HP calculators (no Prime)
|
12-31-2018, 08:20 PM
Post: #341
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Hmm, am I wrong when I think that 71 matches should be simply impossible?
Wikis are great, Contribute :) |
|||
12-31-2018, 08:36 PM
Post: #342
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
(12-31-2018 08:20 PM)pier4r Wrote: Hmm, am I wrong when I think that 71 matches should be simply impossible? Here's a straightforward way to create 21 arrangements where all starting positions (1-71) result in a "match": 1) Find all unique arrangements of a combination of 5 blue and 2 white balls: (1, 1, 1, 1, 0, 0, 1) (0, 1, 1, 1, 0, 1, 1) (1, 1, 0, 0, 1, 1, 1) (1, 1, 1, 0, 1, 1, 0) (1, 0, 1, 0, 1, 1, 1) (0, 1, 1, 0, 1, 1, 1) (1, 1, 1, 1, 0, 1, 0) (1, 1, 0, 1, 1, 0, 1) (1, 0, 1, 1, 1, 0, 1) (1, 1, 1, 0, 0, 1, 1) (0, 1, 1, 1, 1, 0, 1) (1, 1, 0, 1, 1, 1, 0) (1, 0, 1, 1, 1, 1, 0) (1, 0, 0, 1, 1, 1, 1) (0, 1, 1, 1, 1, 1, 0) (0, 0, 1, 1, 1, 1, 1) (0, 1, 0, 1, 1, 1, 1) (1, 1, 1, 1, 1, 0, 0) (1, 1, 1, 0, 1, 0, 1) (1, 1, 0, 1, 0, 1, 1) (1, 0, 1, 1, 0, 1, 1) 2) For each of those groups, repeat the indicated pattern 20 times to form a particular arrangement of 100 1s (blue) and 40 0s (white) Each resulting 140-ball arrangement has 71 "matches" for this problem. In other words, any contiguous subgroup of 70 elements from any of those lists will result in a group containing 50 1s and 20 0s. These aren't the only ones, though. I believe the same logic applies if you start with a set of 10 1s and 4 0s, stepping through each unique arrangement (this time repeated only 10 times). There are undoubtedly others, but I haven't taken the time to verify them. |
|||
01-13-2019, 10:48 AM
(This post was last modified: 01-13-2019 11:07 AM by pier4r.)
Post: #343
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Another little problem that may be solved with a calculator, although the idea is that you try before without.
we have the numbers: 1 2 3 4 5 6 7 8 and we multiply those adjacent to one another, getting: 1x2 2x3 3x4 etc... 2 6 12 20 30 42 56 notice that now we have 7 numbers, not 8. then we continue in this way until we have only one number. Is this number smaller than 10^80 ? if possible use spoilers as usual Code:
Wikis are great, Contribute :) |
|||
01-13-2019, 01:44 PM
Post: #344
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Code: Spoiler alert! So the number is not smaller than 10^80. |
|||
01-13-2019, 01:48 PM
(This post was last modified: 01-13-2019 04:56 PM by Albert Chan.)
Post: #345
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Code: Spoiler alert! |
|||
01-13-2019, 05:05 PM
Post: #346
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
I didn't attempt to apply any symbolic analysis first, as my limited "toolbox" in that regard didn't offer any obvious hints.
Seeing the problem description did, though. So I came up with the following code to produce the numeric result: Code:
The code assumes the initial list is already on the stack before execution. Although I didn't look at the other solutions before putting this together, it does bear a striking resemblance to Thomas' approach. |
|||
01-13-2019, 07:00 PM
(This post was last modified: 01-13-2019 07:00 PM by pier4r.)
Post: #347
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
the idea of using the factors of the final number and then going with the log is a nice one.
Wikis are great, Contribute :) |
|||
01-13-2019, 08:27 PM
(This post was last modified: 01-14-2019 09:23 PM by John Keith.)
Post: #348
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
(01-13-2019 05:05 PM)DavidM Wrote: I didn't attempt to apply any symbolic analysis first, as my limited "toolbox" in that regard didn't offer any obvious hints. I just looked at this thread, and (un)surprisingly my program was exactly the same as yours. The result is the 8th term of A064320, the description of which is very similar to Thomas's derivation. Many interesting ideas here! Additionally, the same operation with + instead of * yields A001792. |
|||
01-28-2019, 01:38 PM
Post: #349
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
While programming a bit in RPL after a long pause I love the possibility to abuse the IF clause (or whatever clause), if needed (read: until I find a better way) nesting an IF in an IF clause sounds glorious.
I don't believe it is good code - to be more clean I should go maybe with IFERR or a better clause structure - but the fact that is possible is amazing. Wikis are great, Contribute :) |
|||
01-31-2019, 04:07 PM
Post: #350
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Interesting...
With conn4x and the hp50g, if I edit directories as text, after they get big enough I get syntax errors that otherwise I don't get. I was not yet able to pinpoint the size, could also depend on the memory free on the device. Solution: create single variables and edit them directly. Wikis are great, Contribute :) |
|||
05-27-2019, 04:47 PM
Post: #351
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
So I was searching for functions for probability distributions built in RPL (hp 50G). For instance the Poisson is not part of the RPL built in functions.
A brief search over hpmuseum.org and hpcalc.org points to the following libraries: Statspack 1.3 https://www.hpcalc.org/details/1285 (2017) StatPack 49 https://www.hpcalc.org/details/4911 (2001) (of course I can always code the functions on my own to refresh them) Interestingly, I did not find any forum post, at least through google, mentioning RPL code for probability distributions. Does anyone have experience with other libraries or those two are good enough? Wikis are great, Contribute :) |
|||
05-27-2019, 06:06 PM
(This post was last modified: 05-27-2019 06:09 PM by pier4r.)
Post: #352
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Together with the question about the statistical distributions for RPL (see previous posts) another question.
In RPL is it possible to have different stacks? Sort of: use the stack, save its state to a variable A, clear . This without knowing how deep the stack is, otherwise one could just pack everything in a list. Then use the stack, save its state to a variable B, clear. Recall A, populate the stack again, work on it, once again save the state to A, clear. etc... Or better maybe DEPTH \->LIST would always work, but then it ends up packing and unpacking a list that slow down things if the list is huge and it is no different than doing 'listVar' object STO+ . This because, as usual, collecting results in a loop while doing other operations is not happening for free and sometimes even vectors are clumsy to use. Wikis are great, Contribute :) |
|||
05-28-2019, 11:09 AM
(This post was last modified: 05-28-2019 11:11 AM by 3298.)
Post: #353
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
With UserRPL you're most likely stuck with DEPTH \->LIST 'varname' STO for saving and 'varname' RCL OBJ\-> DROP for restoring the stack. \->LIST is indeed a bottleneck here due to all the copying it does, though STOring large objects into global variables does some copying too. (On the other hand, moving things into globals gets them out of the way of the garbage collector, which can shave off a few seconds in later parts of the program. I think that's been mentioned in one of your threads already.)
SysRPL gives you more tools though, including the Virtual Stack (pretty much a stack of stacks). This allows you to not only save and restore parts of or the entirety of your stack, but it also grants some limited access (can't change the number of items, basically) to the contents of saved stacks. You can simply ask for the n-th level of the most recent saved stack, or even overwrite that spot with something else. This is sometimes employed in place of complex stackrobatics e.g. when so-called "meta objects" (a series of objects followed by their count, for instance an exploded list) are involved. Come to SysRPL, we have all the awesome toys. ![]() |
|||
05-28-2019, 07:18 PM
Post: #354
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
While I don't doubt that sysRPL is even more powerful than userRPL, the latter is vast enough for my needs. Also diving too much in the RPL world (and I am already at least down to my knee) is dangerous. Already for all little questions I tend to use the 50g instead of using more sane tools (Hp PPL is already much more sane, even with lists limited to 10k objects, as one could nest them). Again, because the digesting speed of mine is slower than the computing speed of the 50g due to the little time available. And still there is newRPL behind the corner!
Wikis are great, Contribute :) |
|||
07-17-2021, 06:13 PM
Post: #355
|
|||
|
|||
RE: Little explorations with HP calculators (no Prime)
Little experience today - maybe already known but maybe it helps to share it - I wanted to connect the 50g to the computer through the connectivity kit (with a win xp system reserved for calculators).
I couldn't connect it, on the stack there were 200 objects (the ram free was 126k), I cleaned the stack and then it worked. Wikis are great, Contribute :) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)