Post Reply 
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 :)
Find all posts by this user
Quote this message in a reply
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.
Find all posts by this user
Quote this message in a reply
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:





















for example at my first estimation I estimated the last number would 
have an upper bound of 128 digits. Because we have:
line 1 max 8.
line 2 max 56
line 3 max 2352
thus line 4, 8 digits
line 5, 16
line 6, 32
line 7, 64
line 8, 128

Theb I refined it utilizing all the numbers trying to estimate the upper bound of theresulting multiplication in digits.
line 1: all 1 digits,
line 2: nnumbers with 1 digit and 2 digits
line 3: numbers from 2 to 4 digits
line 4: numbers from 4 to 8 digits
line 5: numbers from 9 to 15 digits
...
line 8: 96 digits


with the sharp el 506w I got ~ 6.64 e77 . So far away from my estimates.
And it appears I may have made a mistake while inputting numbers on the 506w.

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
01-13-2019, 01:44 PM
Post: #344
RE: Little explorations with HP calculators (no Prime)
Code:
Spoiler alert!










Using the HP-48GX:

{ 1 2 3 4 5 6 7 8 }
« 1 7
  START 2
    « *
    » DOSUBS
  NEXT
»
{ 6.64903611917E80 }


Using binomial coefficients the product can be written as:

1^1 * 2^7 * 3^21 * 4^35 * 5^35 * 6^21 * 7^7 * 8^1 =
8^1 * 14^7 * 18^21 * 20^35 =
6.64903611913E80


Using the common logarithm we can calculate:

 8:    0.90309 *  1 =  0.90309
14:    1.14613 *  7 =  8.02290
18:    1.25527 * 21 = 26.36072
20:    1.30103 * 35 = 45.53605
                      --------
                      80.82276

Even if we only knew the common logarithm of 2, 3 and 7 we can still calculate the needed values:

 2:    0.30103
 3:    0.47712
 7:    0.84510

 8:    0.90309 = 3 * 0.30103
 9:    0.95424 = 2 * 0.47712
18:    1.25527 = 0.95424 + 0.30103
14:    1.14613 = 0.84510 + 0.30103
20:    1.30103 = 1 + 0.30103

So the number is not smaller than 10^80.
Find all posts by this user
Quote this message in a reply
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!










Brute force way:
lst = range(1,9)
while len(lst) > 1: lst = [ i*j for i,j in zip(lst, lst[1:]) ]
print float(lst[0]) ==> 6.64903611914e+80

Distribution way:
Final number should have a binomial distribution of factors:
1 and 8: 1 times
2 and 7: 7 times
3 and 6: 7*6/2 = 21 times
4 and 5: 21*5/3 = 35 times

print 8. * 14**7 * 18**21 * 20**35 ==> 6.64903611914e+80

If only required to confirm above number > 1e80:

X = 8 * (14*18*18*18)**7 * 20**35 > 8 * (16**4)**7 * 2**35 * 1e35

log10(X) > log10(2) * (3 + 4*4*7 + 35) + 35 > 0.301 * 150 + 35 = 80.15 > 80
Find all posts by this user
Quote this message in a reply
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:











\<<
   WHILE
      DUP SIZE 1. >
   REPEAT
      2 { * } DOSUBS
   END
   EVAL
\>>

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.
Find all posts by this user
Quote this message in a reply
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 :)
Find all posts by this user
Quote this message in a reply
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.

Seeing the problem description did, though. So I came up with the following code to produce the numeric result:


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.

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.
Find all posts by this user
Quote this message in a reply
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 :)
Find all posts by this user
Quote this message in a reply
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 :)
Find all posts by this user
Quote this message in a reply
Post Reply 




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