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.

A356721 Numbers written using exactly two distinct Roman numerals.

This page as a plain text file.
%I A356721 #14 Oct 05 2022 05:10:20
%S A356721 4,6,7,8,9,11,12,13,15,19,21,22,23,25,29,31,32,33,35,39,40,51,52,53,
%T A356721 55,60,70,80,90,101,102,103,105,110,120,130,150,190,201,202,203,205,
%U A356721 210,220,230,250,290,301,302,303,305,310,320,330,350,390,400,501,502
%N A356721 Numbers written using exactly two distinct Roman numerals.
%H A356721 Wikipedia, <a href="https://en.wikipedia.org/wiki/Roman_numerals">Roman numerals</a>
%e A356721 4, written IV, and 8, written VIII, are terms.
%e A356721 14, written XIV, is not a term.
%t A356721 kmax=502; a={}; For[k=1, k<=kmax, k++, If[Length[DeleteDuplicates[Characters[RomanNumeral[k]]]] == 2, AppendTo[a,k]]]; a (* _Stefano Spezia_, Aug 26 2022 *)
%o A356721 (Python)
%o A356721 def f(s, k):
%o A356721     return s[:2] if k==4 else (s[1]*(k>=5)+s[0]*(k%5) if k<9 else s[0]+s[2])
%o A356721 def roman(n):
%o A356721     m, c, x, i = n//1000, (n%1000)//100, (n%100)//10, n%10
%o A356721     return "M"*m + f("CDM", c) + f("XLC", x) + f("IVX", i)
%o A356721 def ok(n): return len(set(roman(n))) == 2
%o A356721 print([k for k in range(503) if ok(k)]) # _Michael S. Branicky_, Aug 24 2022
%K A356721 nonn,base,fini,easy
%O A356721 1,1
%A A356721 _Alain Cousquer_ and _Pierre-Hugues Villaume_, Aug 24 2022