login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A002963 Chisel strokes required for Roman numerals for n. 16

%I

%S 1,2,3,3,2,3,4,5,3,2,3,4,5,5,4,5,6,7,5,4,5,6,7,7,6,7,8,9,7,6,7,8,9,9,

%T 8,9,10,11,9,4,5,6,7,7,6,7,8,9,7,2,3,4,5,5,4,5,6,7,5,4,5,6,7,7,6,7,8,

%U 9,7,6,7,8,9,9,8,9,10,11,9,8,9,10,11,11,10,11,12,13,11,4,5,6,7,7,6,7,8,9,7,2,3,4

%N Chisel strokes required for Roman numerals for n.

%C Chisel strokes for numerals: I,1; V,2; X,2; L,2; C ( = < ),2; D,3; M,4.

%C For more about Roman numerals, see A006968.

%C a(A002964(n)) = n. - _Reinhard Zumkeller_, Apr 14 2013

%H Nathaniel Johnston, <a href="/A002963/b002963.txt">Table of n, a(n) for n = 1..3999</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/RomanNumerals.html">Roman Numerals</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Roman_numerals">Roman numerals</a>

%p with(StringTools): A002963 := proc(n) local r: r:=convert(n, roman): return add(parse(SubstituteAll( SubstituteAll( SubstituteAll( SubstituteAll( SubstituteAll( SubstituteAll( SubstituteAll(r[j], "I", "1"), "V", "2"), "X", "2"), "L", "2"), "C", "2"), "D", "3"), "M", "4")), j=1..length(r)): end: seq(A002963(n), n=1..102); # _Nathaniel Johnston_, May 18 2011

%t a[n_] := Characters[ IntegerString[n, "Roman"]] /. {"I" -> 1, "V" -> 2, "X" -> 2, "L" -> 2, "C" -> 2, "D" -> 3, "M" -> 4} // Total; Table[a[n], {n, 1, 102}] (* _Jean-Fran├žois Alcover_, Sep 10 2013 *)

%o (Haskell)

%o a002963 = ch 0 . a061493 where

%o ch s 0 = s

%o ch s x = ch (s + [0,1,2,2,2,2,3,4] !! d') x'

%o where (x',d) = divMod x 10; d' = fromInteger d

%o -- _Reinhard Zumkeller_, Apr 14 2013

%o (PARI) {A002963(n, c=[1000, 4, 900, 6, 500, 3, 400, 5, 100, 2, 90, 4, 50, 2, 40, 4, 10, 2, 9, 3, 5, 2, 4, 3, 1, 1], s=0)= forstep(i=1, #c, 2, while(n>=c[i], n-=c[i]; s+=c[i+1])); s} \\ _M. F. Hasler_, Jul 27 2016

%Y Cf. A119310.

%Y Cf. A061493, A093783.

%K base,easy,nonn,nice

%O 1,2

%A _N. J. A. Sloane_.

%E More terms from _David W. Wilson_.

%E Data double-checked by _M. F. Hasler_, Jul 27 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 7 07:54 EDT 2020. Contains 336274 sequences. (Running on oeis4.)