login
A175240
Call any positive integer that is a palindrome when written in binary a "binary palindrome". a(n) = the smallest binary palindrome such that a(n)*(the n-th binary palindrome) is not a binary palindrome.
2
27, 5, 5, 9, 5, 17, 5, 3, 5, 33, 3, 7, 5, 65, 9, 5, 3, 15, 3, 3, 5, 129, 3, 5, 3, 27, 3, 5, 5, 257, 17, 5, 3, 5, 5, 3, 3, 27, 3, 3, 3, 5, 3, 3, 5, 513, 3, 9, 3, 5, 3, 3, 3, 27, 7, 3, 3, 5, 3, 5, 5, 1025, 33, 5, 3, 9, 5, 3, 3, 5, 5, 5, 3, 3, 3, 3, 3, 27, 3, 3, 5, 3, 3, 3, 3, 5, 3, 3, 3, 5, 3, 3, 5
OFFSET
3,1
COMMENTS
There are no palindromes that work for a(1) and a(2), since the first positive binary palindromes are 0 and 1.
LINKS
FORMULA
A006995(n)*a(n) = A175241(n), a non-palindrome when written in binary.
EXAMPLE
For n=7, A006995(7) = 15 (1111 in binary). And checking 15*A006995(i) for i>=0, we get 15*0=0, 15*1=15, 15*3=45 that belong to A006995, but 15*5=75 does not, so a(7)=5.
MAPLE
bp:= proc(n) local L; L:= convert(n, base, 2); L = ListTools:-Reverse(L) end proc:
Bp:= select(bp, [$0..10^6]): nBp:= nops(Bp):
f:= proc(n) local i;
for i from 3 to nBp do
if not bp(Bp[i]*Bp[n]) then return Bp[i] fi
od;
FAIL
end proc:
map(f, [$3..100]); # Robert Israel, Jan 09 2023
PROG
(PARI) a(n) = my(p=A006995(n), k=1); while(is_A006995(p*A006995(k)), k++); A006995(k); \\ using A006995 PARI codes; Michel Marcus, Jan 09 2023
(Python)
from itertools import count, islice, product
def is_bin_pal(n): return (b:=bin(n)[2:]) == b[::-1]
def bin_pals(): # generator of positive binary palindromes in base 10
yield 1
digits, midrange = 2, [[""], ["0", "1"]]
for digits in count(2):
for p in product("01", repeat=digits//2-1):
left = "1"+"".join(p)
for middle in midrange[digits%2]:
yield int(left + middle + left[::-1], 2)
def agen(): # generator of terms
g = bin_pals(); next(g)
for n in count(3):
bn = next(g)
yield next(k for k in bin_pals() if not is_bin_pal(k*bn))
print(list(islice(agen(), 93))) # Michael S. Branicky, Jan 09 2023
CROSSREFS
Sequence in context: A040712 A040714 A040711 * A204877 A040709 A218014
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Mar 11 2010
EXTENSIONS
Extended by Ray Chandler, Mar 13 2010
Offset 3 from Michel Marcus, Jan 09 2023
STATUS
approved