%I #13 Nov 10 2024 15:18:51
%S 15,17,21,27,31,45,51,63,65,73,85,93,107,119,127,129,153,165,189,195,
%T 219,231,255,257,273,297,325,341,365,381,387,403,427,443,455,471,495,
%U 511,513,561,633,645,693,765,771,819,843,891,903,951,975
%N Nonpalindromes in base 10 that are palindromes in base 2.
%H Robert Israel, <a href="/A124334/b124334.txt">Table of n, a(n) for n = 1..10000</a>
%e 17(10) = 10001(2), a palindrome.
%p N:= 10000: # to get the first N entries
%p count:= 0:
%p for d from 1 while count < N do
%p d1:= ceil(d/2); d2:= d - d1;
%p for x from 2^(d1-1) to 2^d1 - 1 while count < N do
%p if d::even then x1:= x else x1 := floor(x/2) fi;
%p L:= convert(x1,base,2);
%p y:= 2^(d2)*x + add(L[j]*2^(d2-j),j=1..d2);
%p L10:= convert(y,base,10);
%p if ListTools[Reverse](L10) = L10 then next fi;
%p count:= count+1;
%p A[count]:= y;
%p od
%p od:
%p seq(A[n],n=1..N);
%p # _Robert Israel_, Apr 20 2014
%t Select[Range[1000], Reverse[IntegerDigits[ # ]] != IntegerDigits[ # ] && Reverse[IntegerDigits[ #, 2]] == IntegerDigits[ #, 2] &]
%t pal2[n_]:=With[{c=IntegerDigits[n,2]},c==Reverse[c]]; Select[Range[1000],!PalindromeQ[#]&&pal2[#]&] (* _Harvey P. Dale_, Nov 10 2024 *)
%Y Cf. A007632 = numbers that are palindromic in bases 2 and 10.
%K base,nonn
%O 1,1
%A _Tanya Khovanova_, Dec 26 2006