%I #19 Nov 15 2018 03:35:47
%S 0,3,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,
%T 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,
%U 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0
%N a(n) is the largest integer such that n^k is palindromic in binary for all nonnegative integers k that are <= a(n).
%C a(2n) = 0 for all n.
%H Antti Karttunen, <a href="/A140807/b140807.txt">Table of n, a(n) for n = 2..65537</a>
%F For n > 3, a(n)=0 or 1; moreover, a(n)=1 iff n belongs to A006995 (in other words, this sequence is an indicator function of A006995). - _Max Alekseyev_, Jul 22 2008
%e The powers of 3 are, when written in binary: 1, 11, 1001, 11011, 1010001, ... Now, 3^k written in binary is palindromic for k = 0,1,2 and 3, but not for k=4. So a(3) = 3.
%t Array[If[EvenQ@ #, 0, Block[{k = 0}, While[PalindromeQ@ IntegerDigits[#^k, 2], k++]; k - 1]] &, 105, 2] (* _Michael De Vlieger_, Nov 13 2018 *)
%o (PARI) A140807(n) = for(k=1,oo, my(bs=binary(n^k)); if(Vecrev(bs)!=bs,return(k-1))); \\ _Antti Karttunen_, Nov 11 2018
%Y Cf. A006995.
%K nonn,base
%O 2,2
%A _Leroy Quet_, Jul 15 2008
%E More terms from _Max Alekseyev_, Jul 22 2008
|