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.

A061493 Roman numerals written using 1 for I, 2 for V, 3 for X, 4 for L, 5 for C, 6 for D, 7 for M.

This page as a plain text file.
%I A061493 #65 Aug 17 2025 02:46:01
%S A061493 1,11,111,12,2,21,211,2111,13,3,31,311,3111,312,32,321,3211,32111,313,
%T A061493 33,331,3311,33111,3312,332,3321,33211,332111,3313,333,3331,33311,
%U A061493 333111,33312,3332,33321,333211,3332111,33313,34,341,3411,34111,3412
%N A061493 Roman numerals written using 1 for I, 2 for V, 3 for X, 4 for L, 5 for C, 6 for D, 7 for M.
%C A061493 From _Daniel Forgues_, Jan 16 2015: (Start)
%C A061493 The Romans in the era of the Roman Empire did not have 0 as a number.
%C A061493 The initial "N" (nulla, meaning "none", or nihil, meaning "nothing") was used as a zero symbol in a table of Roman numerals by Bede or his colleague around 725, but even in the Middle Ages it never became a standard. (End) [Corrected by _M. F. Hasler_ and _Peter Luschny_, Aug 16 2025]
%C A061493 3999 (MMMCMXCIX) is the largest decimal number that has a well-defined Roman numeral representation. Therefore the sequence deliberately stops there to avoid the ambiguous representations of larger numbers. - _Jamie Robert Creasey_, May 01 2021
%C A061493 The use of 'N' to indicate 0 or "none" long survived in the historic apothecaries' system of measurement, well into the 20th century, to designate quantities in pharmaceutical prescriptions. - _M. F. Hasler_, Aug 16 2025
%H A061493 Reinhard Zumkeller, <a href="/A061493/b061493.txt">Table of n, a(n) for n = 1..3999</a>
%H A061493 Gerard Schildberger, <a href="/A006968/a006968.txt">The first 3999 numbers in Roman numerals</a>
%H A061493 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/RomanNumerals.html">Roman Numerals</a>
%H A061493 Wikipedia, <a href="http://en.wikipedia.org/wiki/Roman_numerals">Roman numerals</a>
%H A061493 Wikipedia, <a href="https://en.wikipedia.org/wiki/0#Classical_antiquity">0 (number) in classical antiquity</a>
%F A061493 a(n)=i <=> A003587(i)=n, for i in {1,...,7}, i.e., A061493 is a left inverse of A003587 on {1,...,7}. - _M. F. Hasler_, Jan 12 2015
%e A061493 a(14) = 312 because 14 = XIV in Roman, and I,V,X are coded as 1,2,3 respectively.
%e A061493 a(66) = 4321, LXVI is 50+10+5+1 = 66, a(44) = 3412, XLIV is -10+50-1+5 = 44
%t A061493 Array[FromDigits[Characters@ RomanNumeral[#] /. {"I" -> 1, "V" -> 2, "X" -> 3, "L" -> 4, "C" -> 5, "D" -> 6, "M" -> 7}] &, 44] (* _Michael De Vlieger_, May 01 2021 *)
%o A061493 (Haskell)
%o A061493 a061493 n = read $ r 1 [] n :: Integer where
%o A061493   r _ roms 0 = roms
%o A061493   r p roms z = case p of
%o A061493     1 -> r 2 (d '1' '2' '3' m) z'
%o A061493     2 -> r 3 (d '3' '4' '5' m ++ roms) z'
%o A061493     3 -> r 4 (d '5' '6' '7' m ++ roms) z'
%o A061493     4 -> replicate z '7' ++ roms
%o A061493     where (z',m) = divMod z 10
%o A061493   d i j k c =
%o A061493     [[],[i],[i,i],[i,i,i],[i,j],[j],[j,i],[j,i,i],[j,i,i,i],[i,k]] !! c
%o A061493 -- _Reinhard Zumkeller_, Apr 14 2013
%o A061493 (PARI) {A061493(n,s="",c=[1000,7,900,57,500,6,400,56,100,5,90,35,50,4,40,34,10,3,9,13,5,2,4,12,1,1])= forstep(i=1,#c,2,while(n>=c[i],n-=c[i];s=Str(s,c[i+1])));eval(s)} \\ _M. F. Hasler_, Jan 11 2015
%o A061493 (Python)
%o A061493 def f(s, k):
%o A061493     return s[:2] if k==4 else (s[1]*(k>=5)+s[0]*(k%5) if k<9 else s[0]+s[2])
%o A061493 def a(n):
%o A061493     m, c, x, i = n//1000, (n%1000)//100, (n%100)//10, n%10
%o A061493     return int("7"*m + f("567", c) + f("345", x) + f("123", i))
%o A061493 print([a(n) for n in range(1, 45)]) # _Michael S. Branicky_, Aug 24 2022
%o A061493 (Python)
%o A061493 import roman
%o A061493 def A061493(n, d={ord(c):str(i) for i,c in enumerate("NIVXLCDM")}):
%o A061493     return int(roman.toRoman(n).translate(d)) # _M. F. Hasler_, Aug 16 2025
%Y A061493 Cf. A006968, A002963, A003587, A036787, A057226.
%Y A061493 Cf. A036746, A036786, A036788, A160676, A160677, A199921.
%K A061493 easy,nonn,base
%O A061493 1,2
%A A061493 _Frank Ellermann_, Jun 12 2001
%E A061493 0 removed again by _Georg Fischer_, Jan 20 2019