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 A259374 #30 May 22 2025 10:21:43 %S A259374 0,1,2,4,26,52,1066,1667,2188,32152,67834,423176,437576,14752936, %T A259374 26513692,27711772,33274388,320785556,1065805109,9012701786, %U A259374 9256436186,12814126552,18814619428,201241053056,478999841578,670919564984,18432110906024,158312796835916,278737550525722 %N A259374 Palindromic numbers in bases 3 and 5 written in base 10. %C A259374 0 is only 0 regardless of the base, %C A259374 1 is only 1 regardless of the base, %C A259374 2 on the other hand is also 10 in base 2, denoted as 10_2, %C A259374 3 is 3 in all bases greater than 3, but is 11_2 and 10_3. %H A259374 Giovanni Resta, <a href="/A259374/b259374.txt">Table of n, a(n) for n = 1..39</a> %H A259374 A.H.M. Smeets, <a href="/A259374/a259374.gif">Scatterplot of log_3(number is palindromic in base 3 and base b) versus b, for b in {2,4,5, 6,7,8,10}</a> %F A259374 Intersection of A014190 and A029952. %e A259374 52 is in the sequence because 52_10 = 202_5 = 1221_3. %t A259374 (* first load nthPalindromeBase from A002113 *) palQ[n_Integer, base_Integer] := Block[{}, Reverse[ idn = IntegerDigits[n, base]] == idn]; k = 0; lst = {}; While[k < 21000000, pp = nthPalindromeBase[k, 5]; If[ palQ[pp, 3], AppendTo[lst, pp]; Print[pp]]; k++]; lst %t A259374 b1=3; b2=5; lst={}; Do[d1=IntegerDigits[n, b1]; d2=IntegerDigits[n, b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 10000000}]; lst (* _Vincenzo Librandi_, Jul 15 2015 *) %o A259374 (Python) %o A259374 def nextpal(n,b): # returns the palindromic successor of n in base b %o A259374 m, pl = n+1, 0 %o A259374 while m > 0: %o A259374 m, pl = m//b, pl+1 %o A259374 if n+1 == b**pl: %o A259374 pl = pl+1 %o A259374 n = (n//(b**(pl//2))+1)//(b**(pl%2)) %o A259374 m = n %o A259374 while n > 0: %o A259374 m, n = m*b+n%b, n//b %o A259374 return m %o A259374 n, a3, a5 = 0, 0, 0 %o A259374 while n <= 20000: %o A259374 if a3 < a5: %o A259374 a3 = nextpal(a3,3) %o A259374 elif a5 < a3: %o A259374 a5 = nextpal(a5,5) %o A259374 else: # a3 == a5 %o A259374 print(n,a3) %o A259374 a3, a5, n = nextpal(a3,3), nextpal(a5,5), n+1 %o A259374 # _A.H.M. Smeets_, Jun 03 2019 %Y A259374 Cf. A048268, A060792, A097856, A097928, A182232, A259374, A097929, A182233, A259375, A259376, A097930, A182234, A259377, A259378, A249156, A097931, A259380-A259384, A099145, A259385-A259390, A099146, A007632, A007633, A029961-A029964, A029804, A029965-A029970, A029731, A097855, A250408-A250411, A099165, A250412. %K A259374 nonn,base %O A259374 1,3 %A A259374 Eric A. Schmidt and _Robert G. Wilson v_, Jul 14 2015