login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A029804 Numbers that are palindromic in bases 8 and 10. 38

%I #43 Sep 08 2022 08:44:50

%S 0,1,2,3,4,5,6,7,9,121,292,333,373,414,585,3663,8778,13131,13331,

%T 26462,26662,30103,30303,207702,628826,660066,1496941,1935391,1970791,

%U 4198914,55366355,130535031,532898235,719848917,799535997,1820330281

%N Numbers that are palindromic in bases 8 and 10.

%C Intersection of A002113 and A029803. - _Michel Marcus_, Nov 20 2014

%H Robert G. Wilson v, <a href="/A029804/b029804.txt">Table of n, a(n) for n = 1..75</a>

%H Patrick De Geest, <a href="http://www.worldofnumbers.com/nobase10.htm">Palindromic numbers beyond base 10</a>

%H Rick Regan, <a href="http://www.exploringbinary.com/finding-numbers-that-are-palindromic-in-multiple-bases/">Code to generate this sequence</a>

%t 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 *)

%t Select[Range[0,1820331000],PalindromeQ[#]&&IntegerDigits[#,8] == Reverse[ IntegerDigits[#,8]]&] (* _Harvey P. Dale_, Mar 18 2019 *)

%o (PARI) isok(n) = (n==0) || ((d10=digits(n, 10)) && (d10==Vecrev(d10)) && (d8=digits(n, 8)) && (d8==Vecrev(d8))); \\ _Michel Marcus_, Nov 13 2014

%o (PARI) ispal(n,r) = my(d=digits(n,r)); d==Vecrev(d);

%o for(n=0,10^7,if(ispal(n,10)&&ispal(n,8),print1(n,", "))); \\ _Joerg Arndt_, Nov 22 2014

%o (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

%o (Python)

%o def palQ8(n): # check if n is a palindrome in base 8

%o s = oct(n)[2:]

%o return s == s[::-1]

%o def palQgen10(l): # unordered generator of palindromes of length <= 2*l

%o if l > 0:

%o yield 0

%o for x in range(1,10**l):

%o s = str(x)

%o yield int(s+s[-2::-1])

%o yield int(s+s[::-1])

%o A029804_list = sorted([n for n in palQgen10(6) if palQ8(n)])

%o # _Chai Wah Wu_, Nov 25 2014

%Y Cf. A007632, A007633, A029961, A029962, A029963, A029964, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A099165.

%K nonn,base

%O 1,3

%A _Patrick De Geest_

%E More terms from _Robert G. Wilson v_, Sep 30 2004

%E Incorrect Mathematica program deleted by _N. J. A. Sloane_, Sep 01 2009

%E Terms 33 through 36 corrected by Rick Regan (exploringbinary(AT)gmail.com), Sep 01 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)