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.

A157712 Smallest prime made up of 0's and prime(n) 1's (or 0 when no such prime exists).

This page as a plain text file.
%I A157712 #14 Jun 13 2021 08:47:30
%S A157712 11,0,101111,11110111,101111111111,101101111111111,101111111111111111,
%T A157712 1111111111111111111,11111111111111111111111,
%U A157712 111110111111111111111111111111,11111101111111111111111111111111
%N A157712 Smallest prime made up of 0's and prime(n) 1's (or 0 when no such prime exists).
%C A157712 Smallest prime with digit sum A000040(n) and using only 0's and 1's. Subsequence of A157709.
%H A157712 Chai Wah Wu, <a href="/A157712/b157712.txt">Table of n, a(n) for n = 1..168</a>
%o A157712 (Python)
%o A157712 from __future__ import division
%o A157712 from itertools import combinations
%o A157712 from sympy import prime, isprime
%o A157712 def A157712(n):
%o A157712     if n == 1:
%o A157712         return 11
%o A157712     if n == 2:
%o A157712         return 0
%o A157712     p = prime(n)
%o A157712     l = p
%o A157712     while True:
%o A157712         for i in combinations(range(l),l-p):
%o A157712             s = ['1']*l
%o A157712             for x in i:
%o A157712                 s[x] = '0'
%o A157712             q = int(''.join(s))
%o A157712             if isprime(q):
%o A157712                 return q
%o A157712         l += 1 # _Chai Wah Wu_, Nov 05 2015
%Y A157712 Cf. A054750.
%K A157712 nonn,base
%O A157712 1,1
%A A157712 _Lekraj Beedassy_, Mar 04 2009
%E A157712 Extended by _Ray Chandler_, Mar 06 2009