[go: up one dir, main page]

login
A029804
Numbers that are palindromic in bases 8 and 10.
38
0, 1, 2, 3, 4, 5, 6, 7, 9, 121, 292, 333, 373, 414, 585, 3663, 8778, 13131, 13331, 26462, 26662, 30103, 30303, 207702, 628826, 660066, 1496941, 1935391, 1970791, 4198914, 55366355, 130535031, 532898235, 719848917, 799535997, 1820330281
OFFSET
1,3
COMMENTS
Intersection of A002113 and A029803. - Michel Marcus, Nov 20 2014
MATHEMATICA
b1=8; b2=10; lst={}; Do[d1=IntegerDigits[n, b1]; d2=IntegerDigits[n, b2]; If[d1==Reverse[d1]&&d2==Reverse[d2], AppendTo[lst, n]], {n, 0, 100000}]; lst (* Vincenzo Librandi, Nov 13 2014 *)
Select[Range[0, 1820331000], PalindromeQ[#]&&IntegerDigits[#, 8] == Reverse[ IntegerDigits[#, 8]]&] (* Harvey P. Dale, Mar 18 2019 *)
PROG
(PARI) isok(n) = (n==0) || ((d10=digits(n, 10)) && (d10==Vecrev(d10)) && (d8=digits(n, 8)) && (d8==Vecrev(d8))); \\ Michel Marcus, Nov 13 2014
(PARI) ispal(n, r) = my(d=digits(n, r)); d==Vecrev(d);
for(n=0, 10^7, if(ispal(n, 10)&&ispal(n, 8), print1(n, ", "))); \\ Joerg Arndt, Nov 22 2014
(Magma) [n: n in [0..10000000] | Intseq(n, 10) eq Reverse(Intseq(n, 10))and Intseq(n, 8) eq Reverse(Intseq(n, 8))]; // Vincenzo Librandi, Nov 23 2014
(Python)
def palQ8(n): # check if n is a palindrome in base 8
s = oct(n)[2:]
return s == s[::-1]
def palQgen10(l): # unordered generator of palindromes of length <= 2*l
if l > 0:
yield 0
for x in range(1, 10**l):
s = str(x)
yield int(s+s[-2::-1])
yield int(s+s[::-1])
A029804_list = sorted([n for n in palQgen10(6) if palQ8(n)])
# Chai Wah Wu, Nov 25 2014
KEYWORD
nonn,base
EXTENSIONS
More terms from Robert G. Wilson v, Sep 30 2004
Incorrect Mathematica program deleted by N. J. A. Sloane, Sep 01 2009
Terms 33 through 36 corrected by Rick Regan (exploringbinary(AT)gmail.com), Sep 01 2009
STATUS
approved