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.
%I A308832 #28 Sep 11 2019 05:04:11 %S A308832 0,1,2,4,8,10,20,364,728,730,1460,2920,5840,7300,7381,7462,14600, %T A308832 14681,14762,265720,531440,531442,532171,532900,1062884,1063613, %U A308832 1064342,2125768,2128684,2131600,4251536,4254452,4257368,5314420,5321710,5329000,5373550,5380840,5388130,5432680,5439970,5447260 %N A308832 Numbers that are palindromic in bases 3, 9 and 27. %C A308832 This sequence is infinite because it contains terms of the forms 729^k-1 (k>=0) and 729^k+1 (k>=0). %C A308832 Let L_27 be the number of digits for a(n) represented in base 27. %C A308832 If L_27 is odd, the digits are either in the set {0, 1, 2} or in {0, 4, 8} or in {0, 10_10, 20_10}. %C A308832 If L_27 is even, the digits are either in the set {0, 13_10} or in {0, 26_10} or in {13_10, 26_10}. %C A308832 Let L_3 be the length of a(n) if represented in base 3, then L_3 in {0,1,2,3} (mod 6). %H A308832 A.H.M. Smeets, <a href="/A308832/b308832.txt">Table of n, a(n) for n = 1..2586</a> %t A308832 palQ[n_,b_] := PalindromeQ[IntegerDigits[n, b]]; aQ[n_] := AllTrue[{3, 9, 27}, palQ[n, #] &]; Select[Range[0, 6*10^6], aQ] (* _Amiram Eldar_, Jul 04 2019 *) %o A308832 (Python) %o A308832 def nextpal(n,base): # m is the first palindrome successor of n in base base %o A308832 m, pl = n+1, 0 %o A308832 while m > 0: %o A308832 m, pl = m//base, pl+1 %o A308832 if n+1 == base**pl: %o A308832 pl = pl+1 %o A308832 n = n//(base**(pl//2))+1 %o A308832 m, n = n, n//(base**(pl%2)) %o A308832 while n > 0: %o A308832 m, n = m*base+n%base, n//base %o A308832 return m %o A308832 def rev(n,b): %o A308832 m = 0 %o A308832 while n > 0: %o A308832 n, m = n//b, m*b+n%b %o A308832 return m %o A308832 n, a = 1, 0 %o A308832 while n <= 20000: %o A308832 if a == rev(a,9) and a == rev(a,3): %o A308832 print(n,a) %o A308832 n = n+1 %o A308832 a = nextpal(a,27) %o A308832 (PARI) nextpal(n, b) = {my(m=n+1, p = 0); while (m > 0, m = m\b; p++;); if (n+1 == b^p, p++); n = n\(b^(p\2))+1; m = n; n = n\(b^(p%2)); while (n > 0, m = m*b + n%b; n = n\b;); m;} \\ after Python %o A308832 ispal(n, b) = my(d=digits(n, b)); Vecrev(d) == d; %o A308832 lista(nn) = {my(k=0); while (k <= nn, if (ispal(k, 3) && ispal(k, 9), print1(k, ", ");); k = nextpal(k, 27););} \\ _Michel Marcus_, Jul 04 2019 %Y A308832 Subsequence of A259386. %Y A308832 Cf. A319584 (palindromic in bases 2, 4 and 8). %K A308832 nonn,base %O A308832 1,3 %A A308832 _A.H.M. Smeets_, Jun 27 2019