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.

Showing 1-2 of 2 results.

A163410 A positive integer is included if it is a palindrome when written in binary, and it is not divisible by any primes that are not binary palindromes.

Original entry on oeis.org

1, 3, 5, 7, 9, 15, 17, 21, 27, 31, 45, 51, 63, 73, 85, 93, 107, 119, 127, 153, 189, 219, 255, 257, 313, 365, 381, 443, 511, 765, 771, 1193, 1241, 1285, 1453, 1533, 1571, 1619, 1787, 1799, 1831, 1879, 2313, 3579, 3855, 4369, 4889, 5113, 5189, 5397, 5557, 5869
Offset: 1

Views

Author

Leroy Quet, Jul 27 2009

Keywords

Examples

			51 in binary is 110011, which is a palindrome. 51 is divisible by the primes 3 and 17. 3 in binary is 11, a palindrome. And 17 in binary is 10001, also a palindrome. Since all the primes dividing the binary palindrome 51 are themselves binary palindromes, then 51 is included in this sequence.
		

Crossrefs

Programs

  • Maple
    dmax:= 15: # to get all terms with at most dmax binary digits
    revdigs:= proc(n)
      local L, Ln, i;
      L:= convert(n, base, 2);
      Ln:= nops(L);
      add(L[i]*2^(Ln-i), i=1..Ln);
    end proc:
    isbpali:= proc(n) option remember; local L; L:= convert(n,base,2); L=ListTools:-Reverse(L) end proc:
    Bp:= {0, 1}:
    for d from 2 to dmax do
      if d::even then
        Bp:= Bp union {seq(2^(d/2)*x + revdigs(x), x=2^(d/2-1)..2^(d/2)-1)}
      else
        m:= (d-1)/2;
        B:={seq(2^(m+1)*x + revdigs(x), x=2^(m-1)..2^m-1)};
        Bp:= Bp union B union map(`+`, B, 2^m)
      fi
    od:
    R:= select(t -> andmap(isbpali, numtheory:-factorset(t)), Bp minus {0}):
    sort(convert(R,list)); # Robert Israel, Dec 19 2016
  • Mathematica
    binPalQ[n_] := PalindromeQ @ IntegerDigits[n, 2]; Select[Range[6000], binPalQ[#] && AllTrue[FactorInteger[#][[;; , 1]], binPalQ] &] (* Amiram Eldar, Mar 30 2021 *)

Extensions

More terms from Sean A. Irvine, Nov 10 2009

A163411 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.

Original entry on oeis.org

33, 65, 99, 129, 165, 195, 231, 273, 297, 325, 341, 387, 403, 427, 455, 471, 495, 513, 561, 585, 633, 645, 693, 717, 819, 843, 891, 903, 951, 975, 1023, 1025, 1057, 1105, 1137, 1161, 1273, 1317, 1365, 1397, 1421, 1501, 1539, 1651, 1675, 1707
Offset: 1

Views

Author

Leroy Quet, Jul 27 2009

Keywords

Comments

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

Examples

			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.
		

Crossrefs

Programs

  • Maple
    dmax:= 15: # to get all terms with at most dmax binary digits
    revdigs:= proc(n)
      local L, Ln, i;
      L:= convert(n, base, 2);
      Ln:= nops(L);
      add(L[i]*2^(Ln-i), i=1..Ln);
    end proc:
    isbpali:= proc(n) option remember; local L; L:= convert(n,base,2); L=ListTools:-Reverse(L) end proc:
    Bp:= {0, 1}:
    for d from 2 to dmax do
      if d::even then
        Bp:= Bp union {seq(2^(d/2)*x + revdigs(x), x=2^(d/2-1)..2^(d/2)-1)}
      else
        m:= (d-1)/2;
        B:={seq(2^(m+1)*x + revdigs(x), x=2^(m-1)..2^m-1)};
        Bp:= Bp union B union map(`+`, B, 2^m)
      fi
    od:
    R:= select(t -> ormap(not isbpali, numtheory:-factorset(t)), Bp):
    sort(convert(R,list)); # Robert Israel, Dec 19 2016
  • Mathematica
    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 *)

Extensions

More terms from Stefan Steinerberger, Aug 05 2009
Corrected by Leroy Quet, Aug 09 2009
Showing 1-2 of 2 results.