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.

A158214 Smallest palindromic prime made up of 0's and k 1's, where k = A007310(n), odd numbers not divisible by 3.

This page as a plain text file.
%I A158214 #11 Dec 18 2015 03:37:25
%S A158214 100111001,110111011,1110111110111,10111101110111101,
%T A158214 100111111111111111001,1111111111111111111,11111111111111111111111,
%U A158214 10111111111101110111111111101,1111110111111111111111110111111
%N A158214 Smallest palindromic prime made up of 0's and k 1's, where k = A007310(n), odd numbers not divisible by 3.
%C A158214 Smallest palindromic prime with digit sum A007310(n) and using only 0's and 1's.
%H A158214 Chai Wah Wu, <a href="/A158214/b158214.txt">Table of n, a(n) for n = 2..167</a>
%o A158214 (Python)
%o A158214 from __future__ import division
%o A158214 from sympy.utilities.iterables import multiset_permutations
%o A158214 from sympy import isprime
%o A158214 A158214_list = []
%o A158214 for i in range(2,101):
%o A158214     if i % 6 == 1 or i % 6 == 5:
%o A158214         i2 = i//2
%o A158214         l = i2
%o A158214         flag = True
%o A158214         while flag:
%o A158214             dlist = '0'*(l-i2) + '1'*i2
%o A158214             for d in multiset_permutations(dlist):
%o A158214                 s = ''.join(d)
%o A158214                 n = int(s+'1'+s[::-1])
%o A158214                 if isprime(n):
%o A158214                     A158214_list.append(n)
%o A158214                     flag = False
%o A158214                     break
%o A158214             else:
%o A158214                 l += 1 # _Chai Wah Wu_, Dec 17 2015
%Y A158214 Cf. A020449.
%K A158214 nonn,base
%O A158214 2,1
%A A158214 _Lekraj Beedassy_, Mar 13 2009