A057226 Number of different symbols needed to express n as a Roman numeral.
1, 1, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 3, 2, 3, 3, 3, 2, 1, 2, 2, 2, 3, 2, 3, 3, 3, 2, 1, 2, 2, 2, 3, 2, 3, 3, 3, 2, 2, 3, 3, 3, 4, 3, 4, 4, 4, 3, 1, 2, 2, 2, 3, 2, 3, 3, 3, 3, 2, 3, 3, 3, 4, 3, 4, 4, 4, 3, 2, 3, 3, 3, 4, 3, 4, 4, 4, 3, 2, 3, 3, 3, 4, 3, 4, 4, 4, 3, 2, 3, 3, 3, 4, 3, 4, 4, 4, 3, 1, 2, 2, 2, 3, 2
Offset: 1
Examples
a(97) = 4 as you need I, V, X and C to express XCVII.
Links
- Nathaniel Johnston, Table of n, a(n) for n = 1..3999
- Eric Weisstein's World of Mathematics, Roman Numerals
- Wikipedia, Roman numerals
Programs
-
Haskell
a057226 = a043537 . a061493 -- Reinhard Zumkeller, Apr 14 2013
-
Maple
with(StringTools): A057226 := proc(n) local r: r:=convert(n, roman): return `if`(Search("I",r)>0,1,0) + `if`(Search("V",r)>0,1,0) + `if`(Search("X",r)>0,1,0) + `if`(Search("L",r)>0,1,0) + `if`(Search("C",r)>0,1,0) + `if`(Search("D",r)>0,1,0) + `if`(Search("M",r)>0,1,0): end: seq(A057226(n), n=1..105); # Nathaniel Johnston, May 18 2011
-
Mathematica
Table[Length[Union[Characters[IntegerString[n,"Roman"]]]],{n,110}] (* Harvey P. Dale, Mar 18 2013 *)
Comments