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.

A144752 Positive integers whose binary representation is a palindrome and has a prime number of 0's.

This page as a plain text file.
%I A144752 #19 Sep 17 2021 17:26:03
%S A144752 9,17,21,45,51,65,85,93,99,107,189,219,231,257,297,325,365,381,387,
%T A144752 427,443,455,471,765,891,951,975,1105,1161,1241,1285,1365,1421,1501,
%U A144752 1533,1539,1619,1675,1755,1787,1799,1879,1911,1935,1967,3069,3579,3831,3951
%N A144752 Positive integers whose binary representation is a palindrome and has a prime number of 0's.
%C A144752 Each term of this sequence is in both sequence A006995 and sequence A144754.
%H A144752 Indranil Ghosh, <a href="/A144752/b144752.txt">Table of n, a(n) for n = 1..11167</a>
%e A144752 17 in binary is 10001. This binary representation is a palindrome, it contains three 0's, and three is a prime. So 17 is a term.
%o A144752 (Python)
%o A144752 from sympy import isprime
%o A144752 def ok(n): b = bin(n)[2:]; return b == b[::-1] and isprime(b.count('0'))
%o A144752 print(list(filter(ok, range(4000)))) # _Michael S. Branicky_, Sep 17 2021
%o A144752 (Python) # faster for computing initial segment of sequence
%o A144752 from sympy import isprime
%o A144752 from itertools import product
%o A144752 def ok2(bin_str): return isprime(bin_str.count("0"))
%o A144752 def bin_pals(maxdigits):
%o A144752     yield from "01"
%o A144752     digits, midrange = 2, [[""], ["0", "1"]]
%o A144752     for digits in range(2, maxdigits+1):
%o A144752         for p in product("01", repeat=digits//2-1):
%o A144752             left = "1"+"".join(p)
%o A144752             for middle in midrange[digits%2]:
%o A144752                 yield left + middle + left[::-1]
%o A144752 def auptopow2(e): return [int(b, 2) for b in filter(ok2, bin_pals(e))]
%o A144752 print(auptopow2(12)) # _Michael S. Branicky_, Sep 17 2021
%Y A144752 Cf. A144753, A006995, A144754
%K A144752 base,nonn
%O A144752 1,1
%A A144752 _Leroy Quet_, Sep 20 2008
%E A144752 Extended by _Ray Chandler_, Nov 04 2008
%E A144752 Name edited by _Michael S. Branicky_, Sep 17 2021