HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's & 0's
01-29-2020, 07:25 AM (This post was last modified: 01-29-2020 07:35 AM by Gerald H.)
Post: #12
 Gerald H Senior Member Posts: 1,461 Joined: May 2014
RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &...
Here my attempt for the 49G, incorporating insights of Albert Chan (as best I could).

Execution time remains lamentably high, improvements expected.

A non-brute force algorithm would be very useful.

Name of programme: A4290

Both

FPTR F 1A is internal SREPL

PTR 2F3A3 is internal SIZE for integers

stable from 1.19-6 to 2.10-8.

Size: 386.5

CkSum: #3E4Dh

Code:
 A4290 ::   CK1&Dispatch   # FF   ::     " MIN K*N ONLY 1'S & 0'S CF A79339"     DispCoord1     SetDA3Temp     ::       FPTR2 ^PUSHFLAGS_       DOBIN       BINT64       dostws       DUP       FPTR2 ^Z>S       BINT2       ZERO_DO       INDEX@       #>$NULL$       FPTR F 1A       DROPLOOP       NULL$? ?SEMI FPTR2 ^ZTrialDiv2 BINT0 ROT BEGIN DUP ZINT 5 FPTR2 ^ZDIVext ZINT 0 EQUAL WHILE :: SWAPDROPSWAP #1+SWAP ; REPEAT DROPDUP FPTR2 ^Z>S "9" NULL$       FPTR F 1A       OVER       NULL$? ITE :: ROTDROP COERCE BINT9 #* ZERO_DO CHR_1 >H$         LOOP         FPTR2 ^S>Z       ;       ::         2DROP         DUP         ZINT 1         EQUAL         ?SEMI         ZINT 10         OVER         PTR 2F3A3         COERCE         FPTR2 ^RP#         FPTR2 ^Z>S         "# "         SWAP&$"b" &$         DOSTR>         HXS 00001 1         bit-         BINT0         BEGIN         DROP         HXS 00001 2         bit+         DUP         hxs>$BINT3 LAST$         FPTR2 ^S>Z         DUP         4PICK         FPTR2 ^ZMod         ZINT 0         EQUAL         UNTIL         ROTROT2DROP       ;       ZINT 10       2SWAP       #MAX       FPTR2 ^RP#       FPTR2 ^RMULText     ;     FPTR2 ^POPFLAGS_   ; ;
 « Next Oldest | Next Newest »

 Messages In This Thread HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's & 0's - Gerald H - 01-24-2020, 04:06 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - ijabbott - 01-24-2020, 08:48 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-25-2020, 05:37 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-24-2020, 11:48 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-25-2020, 05:39 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-25-2020, 02:12 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - John Keith - 01-25-2020, 05:58 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-25-2020, 11:50 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-27-2020, 04:11 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-28-2020, 12:13 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - John Keith - 01-27-2020, 08:09 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-29-2020 07:25 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-30-2020, 12:18 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - John Keith - 01-30-2020, 07:33 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-29-2020, 11:18 AM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-29-2020, 01:58 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-29-2020, 03:12 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Albert Chan - 01-29-2020, 03:22 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-29-2020, 03:37 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-30-2020, 08:32 PM RE: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's &... - Gerald H - 01-31-2020, 08:01 AM

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