HP Forums
HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's & 0's - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: HP 49G: Minimum Multiplier M of Integer N such that M*N Consists Only of 1's & 0's (/thread-14407.html)

Pages: 1 2


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

Sorry, error crept into previous posted version, here correction:

Code:
Size: 352.5

CkSum: # 1000100011011100b

::
  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
        %2
        OVER
        PTR 2F3A3
        %^
        %>#
        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_
  ;
;