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.

A020450 Primes that contain digits 1 and 2 only.

This page as a plain text file.
%I A020450 #39 Apr 13 2025 08:20:01
%S A020450 2,11,211,2111,2221,12211,21121,21211,21221,22111,111121,111211,
%T A020450 112111,112121,1111211,1121221,1212121,1212221,1221221,2121121,
%U A020450 2211211,2221111,11221211,12111221,12121121,12121211,12122111,12122221,12212111,12222121
%N A020450 Primes that contain digits 1 and 2 only.
%H A020450 Jason Bard, <a href="/A020450/b020450.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Vincenzo Librandi)
%t A020450 Flatten[Table[Select[FromDigits/@Tuples[{1,2},n],PrimeQ],{n,8}]] (* _Vincenzo Librandi_, Jul 28 2012 *)
%o A020450 (PARI) for(nd=1,9, forvec(v=vector(nd,i,[49,50-(i==nd && i>1)]), isprime(t=eval(Strchr(Vecsmall(v)))) && print1(t","))) \\ _M. F. Hasler_, Mar 18 2010
%o A020450 (Magma) [p: p in PrimesUpTo(12222121) | Set(Intseq(p)) subset [1, 2]]; // _Vincenzo Librandi_, Jul 28 2012
%o A020450 (Python)
%o A020450 from sympy import primerange
%o A020450 def checkd(a, c):
%o A020450     b =  set(int(i) for i in set(str(a)))
%o A020450     return b.issubset(c)
%o A020450 for n in primerange(2, 2000000):
%o A020450     if checkd(n, [1, 2]):
%o A020450         print(n)
%o A020450 # _Abhiram R Devesh_, May 08 2015
%Y A020450 Cf. A020449 (digits 0 & 1), ..., A020472 (digits 8 & 9). [From _M. F. Hasler_, Mar 18 2010]
%Y A020450 Subsequence of A007931.
%K A020450 nonn,base
%O A020450 1,1
%A A020450 _David W. Wilson_