A093796 Sequence of digit-values after concatenating the natural numbers < 4000 in Roman numeral representation.
1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 1, 5, 1, 1, 5, 1, 1, 1, 1, 10, 10, 10, 1, 10, 1, 1, 10, 1, 1, 1, 10, 1, 5, 10, 5, 10, 5, 1, 10, 5, 1, 1, 10, 5, 1, 1, 1, 10, 1, 10, 10, 10, 10, 10, 1, 10, 10, 1, 1, 10, 10, 1, 1, 1, 10, 10, 1, 5, 10, 10, 5, 10, 10, 5, 1, 10, 10, 5, 1
Offset: 1
Examples
I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII, ... I,(I,I),(I,I,I),(I,V),V,(V,I),(V,I,I),(V,I,I,I),(I,X), ... 1,(1,1),(1,1,1),(1,5),5,(5,1),(5,1,1),(5,1,1,1),(1,10), ... 1,1,1,1,1,1,1,5,5,5,1,5,1,1,5,1,1,1,1,10,10,10,1,10,1,1, ...
References
- GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See Question 300(b), page 199.
Links
- Nathaniel Johnston, Table of n, a(n) for n = 1..30000 (complete up to 3999)
- Stephanus Gibbs, Roman Numeral and Date Conversion
- Eric Weisstein's World of Mathematics, Roman Numerals
Programs
-
Haskell
import Data.List (unfoldr) a093796 n = a093796_list !! n a093796_list = concatMap (reverse . unfoldr r) $ map a061493 [1..3999] where r 0 = Nothing r x = Just ([0,1,5,10,50,100,500,1000] !! fromInteger d, x') where (x', d) = divMod x 10 -- Reinhard Zumkeller, Apr 14 2013
-
Maple
for n from 1 to 50 do r:=convert(n, roman): for j from 1 to length(r) do printf("%d, ", convert(r[j],arabic)): od: od: # Nathaniel Johnston, May 18 2011
-
Mathematica
A093796full = Flatten[FromRomanNumeral[Characters[RomanNumeral[Range[3999]]]]]; A093796full[[;;100]] (* Paolo Xausa, Mar 03 2024 *)
-
Python
def f(s, k): return s[:2] if k==4 else (s[1]*(k>=5)+s[0]*(k%5) if k<9 else s[0]+s[2]) def r(n): m, c, x, i = n//1000, (n%1000)//100, (n%100)//10, n%10 return "M"*m + f("CDM", c) + f("XLC", x) + f("IVX", i) def afull(): v = {"I":1, "V":5, "X":10, "L":50, "C":100, "D":500, "M":1000} ans = [] for i in range(1, 4000): ans.extend([v[d] for d in r(i)]) return ans print(afull()[:80]) # Michael S. Branicky, Mar 04 2024
Comments