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.

A124334 Nonpalindromes in base 10 that are palindromes in base 2.

Original entry on oeis.org

15, 17, 21, 27, 31, 45, 51, 63, 65, 73, 85, 93, 107, 119, 127, 129, 153, 165, 189, 195, 219, 231, 255, 257, 273, 297, 325, 341, 365, 381, 387, 403, 427, 443, 455, 471, 495, 511, 513, 561, 633, 645, 693, 765, 771, 819, 843, 891, 903, 951, 975
Offset: 1

Views

Author

Tanya Khovanova, Dec 26 2006

Keywords

Examples

			17(10) = 10001(2), a palindrome.
		

Crossrefs

Cf. A007632 = numbers that are palindromic in bases 2 and 10.

Programs

  • Maple
    N:= 10000: # to get the first N entries
    count:= 0:
    for d from 1 while count < N do
       d1:= ceil(d/2); d2:= d - d1;
       for x from 2^(d1-1) to 2^d1 - 1 while count < N do
          if d::even then x1:= x else x1 := floor(x/2) fi;
          L:= convert(x1,base,2);
          y:= 2^(d2)*x + add(L[j]*2^(d2-j),j=1..d2);
          L10:= convert(y,base,10);
          if ListTools[Reverse](L10) = L10 then next fi;
          count:= count+1;
          A[count]:= y;
       od
    od:
    seq(A[n],n=1..N);
    # Robert Israel, Apr 20 2014
  • Mathematica
    Select[Range[1000], Reverse[IntegerDigits[ # ]] != IntegerDigits[ # ] && Reverse[IntegerDigits[ #, 2]] == IntegerDigits[ #, 2] &]
    pal2[n_]:=With[{c=IntegerDigits[n,2]},c==Reverse[c]]; Select[Range[1000],!PalindromeQ[#]&&pal2[#]&] (* Harvey P. Dale, Nov 10 2024 *)