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).
Original entry on oeis.org
11, 0, 100111001, 110111011, 1110111110111, 10111101110111101, 100111111111111111001, 1111111111111111111, 11111111111111111111111, 1111110111111111111111110111111, 11111101111111110101111111110111111
Offset: 1
-
from _future_ import division
from itertools import combinations
from sympy import prime, isprime
def A158215(n):
if n == 1:
return 11
if n == 2:
return 0
p2 = prime(n)//2
l = p2
while True:
for i in combinations(range(l),l-p2):
s = ['1']*l
for x in i:
s[x] = '0'
s = ''.join(s)
q = int(s+'1'+s[::-1])
if isprime(q):
return q
l += 1 # Chai Wah Wu, Nov 05 2015
A253631
Palindromic primes containing only the digits 0 and 1 such that their squares are palindromes.
Original entry on oeis.org
11, 101, 100111001, 110111011, 111010111, 1100011100011, 1100101010011, 1101010101011, 100110101011001, 101000010000101, 101011000110101, 101110000011101, 10000010101000001, 10011010001011001, 10100110001100101, 10110010001001101, 10111000000011101, 11010001010001011, 1000010101010100001, 1001010100010101001
Offset: 1
11 is a palindromic prime, and 11^2 = 121 is a palindrome.
-
Select[FromDigits/@Tuples[{0,1},20],PalindromeQ[#]&&PrimeQ[#] && PalindromeQ[ #^2]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Feb 13 2017 *)
Select[FromDigits/@Tuples[{0,1},20],PrimeQ[#]&&AllTrue[{#,#^2},PalindromeQ]&] (* Harvey P. Dale, Jan 14 2024 *)
-
from sympy import isprime
A253631_list = [11]
for i in range(2, 2**30):
s = format(i, 'b')
x = int(s+s[-2::-1])
s2 = str(x*x)
if s2 == s2[::-1] and isprime(x):
A253631_list.append(x)
A344424
Numbers k such that A344423(k) is prime.
Original entry on oeis.org
3, 54, 58, 64, 70, 253, 438, 4255, 8770
Offset: 1
A344423(3) = 100111001 is prime, so 3 is a term of the sequence.
Showing 1-3 of 3 results.
Comments