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.

A158215 Smallest palindromic prime made up of 0's and p(n) 1's, where p(n) is the n-th prime = A000040(n) (or 0 when no such prime exists).

This page as a plain text file.
%I A158215 #10 Nov 06 2015 02:01:26
%S A158215 11,0,100111001,110111011,1110111110111,10111101110111101,
%T A158215 100111111111111111001,1111111111111111111,11111111111111111111111,
%U A158215 1111110111111111111111110111111,11111101111111110101111111110111111
%N A158215 Smallest palindromic prime made up of 0's and p(n) 1's, where p(n) is the n-th prime = A000040(n) (or 0 when no such prime exists).
%C A158215 Smallest palindromic prime with digit sum A000040(n) and using only 0's and 1's. Subsequence of A158214.
%C A158215 Smallest palindromic prime with digit sum A000040(n) and using only 0's and 1's. Subsequence of A100580.(Sequence link edited). [_Lekraj Beedassy_, Jun 21 2009]
%H A158215 Chai Wah Wu, <a href="/A158215/b158215.txt">Table of n, a(n) for n = 1..168</a>
%o A158215 (Python)
%o A158215 from __future__ import division
%o A158215 from itertools import combinations
%o A158215 from sympy import prime, isprime
%o A158215 def A158215(n):
%o A158215     if n == 1:
%o A158215         return 11
%o A158215     if n == 2:
%o A158215         return 0
%o A158215     p2 = prime(n)//2
%o A158215     l = p2
%o A158215     while True:
%o A158215         for i in combinations(range(l),l-p2):
%o A158215             s = ['1']*l
%o A158215             for x in i:
%o A158215                 s[x] = '0'
%o A158215             s = ''.join(s)
%o A158215             q = int(s+'1'+s[::-1])
%o A158215             if isprime(q):
%o A158215                 return q
%o A158215         l += 1 # _Chai Wah Wu_, Nov 05 2015
%Y A158215 Cf. A157712
%Y A158215 Cf. A158214. [_Lekraj Beedassy_, Jun 21 2009]
%K A158215 nonn,base
%O A158215 1,1
%A A158215 _Lekraj Beedassy_, Mar 13 2009