HP Forums
(49G) Number of Characters in Roman representation (OEIS A006968) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (49G) Number of Characters in Roman representation (OEIS A006968) (/thread-4636.html)



(49G) Number of Characters in Roman representation (OEIS A006968) - Gerald H - 09-03-2015 12:32 PM

For integer input N the programme returns the number of letters required for the Roman representation of N, in accord with

http://oeis.org/A006968

Code:

::
  CK1&Dispatch
  BINT1
  ::
    COERCE
    BINT0
    BINT3
    ZERO_DO
    SWAP
    BINT10
    #/
    3UNROLL
    ::
      BINT4
      OVER#>
      ?SEMI
      BINT5
      #=casedrop
      BINT1
      BINT7
      #=casedrop
      BINT3
      BINT8
      #=case
      BINT4
      BINT2
    ;
    #+
    LOOP
    #+
    FPTR2 ^#>Z
  ;
;