OFFSET
1,3
COMMENTS
This sequence is infinite as it contains 15*(1 + 16^k) for any k > 0. - Rémy Sigrist, Sep 23 2018
Palindromes in base 16 whose nonzero base-16 digits are either all 1, all 3, all 5 or all F (15). - Robert Israel, Nov 12 2023
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
255 is 11111111 in binary, 3333 in quaternary and FF in hexadecimal. Hence 255 is in the sequence.
Although 21 is 10101 in binary and 111 in quaternary, it is 15 in hexadecimal and therefore not in the sequence.
MAPLE
extend:= proc(x, d)
local a, b, m;
if d::odd then
m:= (d-1)/2;
a:= x mod 16^(m+1);
b:= floor(x/16^m);
a + 16^(m+1)*b
else
m:= d/2;
a:= x mod 16^m;
b:= floor(x/16^m);
(a + 16^(m+1)*b, a + 16^m * (a mod 16) + 16^(m+1)*b)
fi
end proc:
V:= [1, 3, 5, 15]: R:= 0, op(V):
for d from 1 to 6 do
V:= map(extend, V, d);
R:= R, op(V);
od:
R; # Robert Israel, Nov 12 2023
MATHEMATICA
palQ[n_, b_] := PalindromeQ[IntegerDigits[n, b]];
Reap[Do[If[palQ[n, 2] && palQ[n, 4] && palQ[n, 16], Print[n]; Sow[n]], {n, 0, 10^6}]][[2, 1]] (* Jean-François Alcover, Sep 25 2018 *)
PROG
(Sage) [n for n in (0..1000) if Word(n.digits(2)).is_palindrome() and Word(n.digits(4)).is_palindrome() and Word(n.digits(16)).is_palindrome()]
(Magma) [n: n in [0..2*10^7] | Intseq(n, 2) eq Reverse(Intseq(n, 2)) and Intseq(n, 4) eq Reverse(Intseq(n, 4)) and Intseq(n, 16) eq Reverse(Intseq(n, 16))]; // Vincenzo Librandi, Sep 24 2018
CROSSREFS
KEYWORD
AUTHOR
Jeremias M. Gomes, Sep 23 2018
STATUS
approved