login
Palindromic primes containing only the digits 0 and 1 such that their squares are palindromes.
1

%I #13 Jan 14 2024 16:10:34

%S 11,101,100111001,110111011,111010111,1100011100011,1100101010011,

%T 1101010101011,100110101011001,101000010000101,101011000110101,

%U 101110000011101,10000010101000001,10011010001011001,10100110001100101,10110010001001101,10111000000011101,11010001010001011,1000010101010100001,1001010100010101001

%N Palindromic primes containing only the digits 0 and 1 such that their squares are palindromes.

%C Subsequence of A100580.

%C Conjecture: a(n) = A225603(n+2).

%H Chai Wah Wu, <a href="/A253631/b253631.txt">Table of n, a(n) for n = 1..938</a>

%e 11 is a palindromic prime, and 11^2 = 121 is a palindrome.

%t Select[FromDigits/@Tuples[{0,1},20],PalindromeQ[#]&&PrimeQ[#] && PalindromeQ[ #^2]&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Feb 13 2017 *)

%t Select[FromDigits/@Tuples[{0,1},20],PrimeQ[#]&&AllTrue[{#,#^2},PalindromeQ]&] (* _Harvey P. Dale_, Jan 14 2024 *)

%o (Python)

%o from sympy import isprime

%o A253631_list = [11]

%o for i in range(2,2**30):

%o ....s = format(i,'b')

%o ....x = int(s+s[-2::-1])

%o ....s2 = str(x*x)

%o ....if s2 == s2[::-1] and isprime(x):

%o ........A253631_list.append(x)

%K nonn,base

%O 1,1

%A _Chai Wah Wu_, Jan 06 2015