login
A positive integer is included if it is a palindrome when written in binary, and it is divisible by at least one prime that is not a binary palindrome.
2

%I #17 Dec 19 2016 04:07:59

%S 33,65,99,129,165,195,231,273,297,325,341,387,403,427,455,471,495,513,

%T 561,585,633,645,693,717,819,843,891,903,951,975,1023,1025,1057,1105,

%U 1137,1161,1273,1317,1365,1397,1421,1501,1539,1651,1675,1707

%N A positive integer is included if it is a palindrome when written in binary, and it is divisible by at least one prime that is not a binary palindrome.

%C All positive integers that are palindromes when written in binary are exclusively either in this sequence or in sequence A163410.

%H Robert Israel, <a href="/A163411/b163411.txt">Table of n, a(n) for n = 1..10000</a>

%e 99 in binary is 1100011, which is a palindrome. 99 is divisible by the primes 3 and 11. 3 in binary is 11, a palindrome. But 11(decimal) in binary is 1011, not a palindrome. Since there is at least one prime dividing the binary palindrome 99 that is not a binary palindrome, then 99 is included in this sequence.

%p dmax:= 15: # to get all terms with at most dmax binary digits

%p revdigs:= proc(n)

%p local L, Ln, i;

%p L:= convert(n, base, 2);

%p Ln:= nops(L);

%p add(L[i]*2^(Ln-i), i=1..Ln);

%p end proc:

%p isbpali:= proc(n) option remember; local L; L:= convert(n,base,2); L=ListTools:-Reverse(L) end proc:

%p Bp:= {0, 1}:

%p for d from 2 to dmax do

%p if d::even then

%p Bp:= Bp union {seq(2^(d/2)*x + revdigs(x), x=2^(d/2-1)..2^(d/2)-1)}

%p else

%p m:= (d-1)/2;

%p B:={seq(2^(m+1)*x + revdigs(x), x=2^(m-1)..2^m-1)};

%p Bp:= Bp union B union map(`+`, B, 2^m)

%p fi

%p od:

%p R:= select(t -> ormap(not isbpali, numtheory:-factorset(t)), Bp):

%p sort(convert(R,list)); # _Robert Israel_, Dec 19 2016

%t a = {}; For[n = 2, n < 10000, n++, If[FromDigits[Reverse[IntegerDigits[n, 2]], 2] == n, b = Table[FactorInteger[n][[i, 1]], {i, 1, Length[FactorInteger[n]]}]; For[i = 1, i < Length[b] + 1, i++, If[ ! FromDigits[Reverse[IntegerDigits[b[[i]], 2]], 2] == b[[i]], AppendTo[a, n]; Break]]]]; a (* _Stefan Steinerberger_, Aug 05 2009 *)

%Y Cf. A006995, A163410, A207039.

%K base,nonn

%O 1,1

%A _Leroy Quet_, Jul 27 2009

%E More terms from _Stefan Steinerberger_, Aug 05 2009

%E Corrected by _Leroy Quet_, Aug 09 2009