cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A093783 Sum of digits of n in Roman numeral representation.

Original entry on oeis.org

1, 2, 3, 6, 5, 6, 7, 8, 11, 10, 11, 12, 13, 16, 15, 16, 17, 18, 21, 20, 21, 22, 23, 26, 25, 26, 27, 28, 31, 30, 31, 32, 33, 36, 35, 36, 37, 38, 41, 60, 61, 62, 63, 66, 65, 66, 67, 68, 71, 50, 51, 52, 53, 56, 55, 56, 57, 58, 61, 60, 61, 62, 63, 66, 65, 66, 67, 68
Offset: 1

Views

Author

Reinhard Zumkeller, May 17 2004

Keywords

Examples

			n=42 == XLII: a(42) = 'X' + 'L' + 'I' + 'I' = 10+50+1+1 = 62.
		

Crossrefs

Programs

  • Haskell
    a093783 n = q 0 $ a061493 n where
         q s 0 = s
         q s x = q (s + [0,1,5,10,50,100,500,1000] !! d') x'
                 where  (x',d) = divMod x 10; d' = fromInteger d
    -- Reinhard Zumkeller, Apr 14 2013
    (HP 49G calculator)
    ::
      CK1&Dispatch
      # FF
      ::
        FPTR2 ^DupQIsZero?
        caseSIZEERR
        FPTR2 ^Z>S
        Z0_
        SWAP
        DUPLEN$
        ZERO_DO
        DUP
        ISTOP-INDEX
        SUB$1#
        BINT48
        #-
        BINT4
        OVER#=
        OVER
        BINT9
        #=
        OR
        IT
        #2+
        FPTR2 ^#>Z
        Z10_
        INDEX@
        FPTR2 ^RP#
        FPTR2 ^RMULText
        ROT
        FPTR2 ^RADDext
        SWAPLOOP
        DROP
      ;
    ;
    Gerald Hillier, Sep 08 2015
  • Maple
    A093783 := proc(n) local r: r:=convert(n, roman): return add(convert(r[j], arabic), j=1..length(r)): end: seq(A093783(n), n=1..68); # Nathaniel Johnston, May 18 2011
  • Mathematica
    Total[#2 FromRomanNumeral[#1] & @@@ Tally[Characters@ RomanNumeral@ #]] & /@ Range@ 68 (* Michael De Vlieger, Sep 08 2015, Version 10.2 *)