Search: a029952 -id:a029952
|
|
A002113
|
|
Palindromes in base 10.
(Formerly M0484 N0178)
|
|
+10
797
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 202, 212, 222, 232, 242, 252, 262, 272, 282, 292, 303, 313, 323, 333, 343, 353, 363, 373, 383, 393, 404, 414, 424, 434, 444, 454, 464, 474, 484, 494, 505, 515
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
It seems that if n*reversal(n) is in the sequence then n = 3 or all digits of n are less than 3. - Farideh Firoozbakht, Nov 02 2014
The position of a palindrome within the sequence can be determined almost without calculation: If the palindrome has an even number of digits, prepend a 1 to the front half of the palindrome's digits. If the number of digits is odd, prepend the value of front digit + 1 to the digits from position 2 ... central digit. Examples: 98766789 = a(19876), 515 = a(61), 8206028 = a(9206), 9230329 = a(10230). - Hugo Pfoertner, Aug 14 2015
The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - Jonathan Sondow, Nov 27 2017
The number of palindromes with d digits is 10 if d = 1, and otherwise it is 9 * 10^(floor((d - 1)/2)). - N. J. A. Sloane, Dec 06 2015
Sequence A033665 tells how many iterations of the Reverse-then-add function A056964 are needed to reach a palindrome; numbers for which this will never happen are Lychrel numbers (A088753) or rather Kin numbers (A023108). - M. F. Hasler, Apr 13 2019
|
|
REFERENCES
|
Karl G. Kröber, "Palindrome, Perioden und Chaoten: 66 Streifzüge durch die palindromischen Gefilde" (1997, Deutsch-Taschenbücher; Bd. 99) ISBN 3-8171-1522-9.
Clifford A. Pickover, A Passion for Mathematics, Wiley, 2005; see p. 71.
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
read transforms; t0:=[]; for n from 0 to 2000 do if digrev(n) = n then t0:=[op(t0), n]; fi; od: t0;
# Alternatively, to get all palindromes with <= N digits in the list "Res":
N:=5;
Res:= $0..9:
for d from 2 to N do
if d::even then
m:= d/2;
Res:= Res, seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1);
else
m:= (d-1)/2;
Res:= Res, seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1);
fi
# A variant: Gets all base-10 palindromes with exactly d digits, in the list "Res"
d:=4:
if d=1 then Res:= [$0..9]:
elif d::even then
m:= d/2:
Res:= [seq(n*10^m + digrev(n), n=10^(m-1)..10^m-1)]:
else
m:= (d-1)/2:
Res:= [seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]:
fi:
isA002113 := proc(n)
simplify(digrev(n) = n) ;
|
|
MATHEMATICA
|
palQ[n_Integer, base_Integer] := Module[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; (* then to generate any base-b sequence for 1 < b < 37, replace the 10 in the following instruction with b: *) Select[Range[0, 1000], palQ[#, 10] &]
base10Pals = {0}; r = 2; Do[Do[AppendTo[base10Pals, n * 10^(IntegerLength[n] - 1) + FromDigits@Rest@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}]; Do[AppendTo[base10Pals, n * 10^IntegerLength[n] + FromDigits@Reverse@IntegerDigits[n]], {n, 10^(e - 1), 10^e - 1}], {e, r}]; base10Pals (* Arkadiusz Wesolowski, May 04 2012 *)
nthPalindromeBase[n_, b_] := Block[{q = n + 1 - b^Floor[Log[b, n + 1 - b^Floor[Log[b, n/b]]]], c = Sum[Floor[Floor[n/((b + 1) b^(k - 1) - 1)]/(Floor[n/((b + 1) b^(k - 1) - 1)] - 1/b)] - Floor[Floor[n/(2 b^k - 1)]/(Floor[n/(2 b^k - 1)] - 1/ b)], {k, Floor[Log[b, n]]}]}, Mod[q, b] (b + 1)^c * b^Floor[Log[b, q]] + Sum[Floor[Mod[q, b^(k + 1)]/b^k] b^(Floor[Log[b, q]] - k) (b^(2 k + c) + 1), {k, Floor[Log[b, q]]}]] (* after the work of Eric A. Schmidt, works for all integer bases b > 2 *)
Array[nthPalindromeBase[#, 10] &, 61, 0] (* please note that Schmidt uses a different, a more natural and intuitive offset, that of a(1) = 1. - Robert G. Wilson v, Sep 22 2014 and modified Nov 28 2014 *)
|
|
PROG
|
(PARI) is_A002113(n)=Vecrev(n=digits(n))==n \\ M. F. Hasler, Nov 17 2008, updated Apr 26 2014, Jun 19 2018
(PARI) is(n)=n=digits(n); for(i=1, #n\2, if(n[i]!=n[#n+1-i], return(0))); 1 \\ Charles R Greathouse IV, Jan 04 2013
(PARI) a(n)={my(d, i, r); r=vector(#digits(n-10^(#digits(n\11)))+#digits(n\11)); n=n-10^(#digits(n\11)); d=digits(n); for(i=1, #d, r[i]=d[i]; r[#r+1-i]=d[i]); sum(i=1, #r, 10^(#r-i)*r[i])} \\ David A. Corneth, Jun 06 2014
(PARI) \\ recursive--feed an element a(n) and it gives a(n+1)
nxt(n)=my(d=digits(n)); i=(#d+1)\2; while(i&&d[i]==9, d[i]=0; d[#d+1-i]=0; i--); if(i, d[i]++; d[#d+1-i]=d[i], d=vector(#d+1); d[1]=d[#d]=1); sum(i=1, #d, 10^(#d-i)*d[i]) \\ David A. Corneth, Jun 06 2014
(PARI) \\ feed a(n), returns n.
inv(n)={my(d=digits(n)); q=ceil(#d/2); sum(i=1, q, 10^(q-i)*d[i])+10^floor(#d/2)} \\ David A. Corneth, Jun 18 2014
(PARI) inv_A002113(P)={P\(P=10^(logint(P+!P, 10)\/2))+P} \\ index n of palindrome P = a(n), much faster than above: no sum is needed. - M. F. Hasler, Sep 09 2018
(PARI) A002113(n, L=logint(n, 10))=(n-=L=10^max(L-(n<11*10^(L-1)), 0))*L+fromdigits(Vecrev(digits(if(n<L, n, n\10)))) \\ M. F. Hasler, Sep 11 2018
mlist=[]
for n in range(nMax+1):
mstr=str(n)
if mstr==mstr[::-1]:
mlist.append(n)
(Python)
from itertools import chain
A002113 = sorted(chain(map(lambda x:int(str(x)+str(x)[::-1]), range(1, 10**3)), map(lambda x:int(str(x)+str(x)[-2::-1]), range(10**3)))) # Chai Wah Wu, Aug 09 2014
(Python)
from itertools import chain, count
A002113 = chain(k for k in count(0) if str(k) == str(k)[::-1])
(Python)
from math import log10
if n < 2: return 0
P = 10**floor(log10(n//2)); M = 11*P
s = str(n - (P if n < M else M-P))
return int(s + s[-2 if n < M else -1::-1]) # M. F. Hasler, Jun 06 2024
(Haskell)
a002113 n = a002113_list !! (n-1)
(Haskell)
import Data.List.Ordered (union)
a002113_list = union a056524_list a056525_list -- Reinhard Zumkeller, Jul 29 2015, Dec 28 2011
(Magma) [n: n in [0..600] | Intseq(n, 10) eq Reverse(Intseq(n, 10))]; // Vincenzo Librandi, Nov 03 2014
(SageMath)
[n for n in (0..515) if Word(n.digits()).is_palindrome()] # Peter Luschny, Sep 13 2018
(GAP) Filtered([0..550], n->ListOfDigits(n)=Reversed(ListOfDigits(n))); # Muniru A Asiru, Mar 08 2019
(Scala) def palQ(n: Int, b: Int = 10): Boolean = n - Integer.parseInt(n.toString.reverse) == 0
|
|
CROSSREFS
|
Palindromes in bases 2 through 11: A006995 and A057148, A014190 and A118594, A014192 and A118595, A029952 and A118596, A029953 and A118597, A029954 and A118598, A029803 and A118599, A029955 and A118600, this sequence, A029956. Also A262065 (base 60), A262069 (subsequence).
Minimal number of palindromes that add to n using greedy algorithm: A088601.
Minimal number of palindromes that add to n: A261675.
|
|
KEYWORD
|
nonn,base,easy,nice,core
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A014190
|
|
Palindromes in base 3 (written in base 10).
|
|
+10
55
|
|
|
0, 1, 2, 4, 8, 10, 13, 16, 20, 23, 26, 28, 40, 52, 56, 68, 80, 82, 91, 100, 112, 121, 130, 142, 151, 160, 164, 173, 182, 194, 203, 212, 224, 233, 242, 244, 280, 316, 328, 364, 400, 412, 448, 484, 488, 524, 560, 572, 608, 644, 656, 692, 728, 730, 757
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Rajasekaran, Shallit, & Smith prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
Eric Weisstein's World of Mathematics, Ternary.
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 2.61676111... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MAPLE
|
isA014190 := proc(n)
local L;
L := convert(n, base, 3) ;
ListTools[Reverse](L) = L ;
end proc:
for n from 0 to 500 do
if isA014190(n) then
printf("%d, ", n) ;
end if;
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 3], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
|
|
PROG
|
(Magma) [n: n in [0..800] | Intseq(n, 3) eq Reverse(Intseq(n, 3))]; // Vincenzo Librandi, Sep 09 2015
(Sage)
[n for n in (0..757) if Word(n.digits(3)).is_palindrome()] # Peter Luschny, Sep 13 2018
(Python)
from gmpy2 import digits
if n == 1: return 0
y = 3*(x:=3**(len(digits(n>>1, 3))-1))
return int((c:=n-x)*x+int(digits(c, 3)[-2::-1]or'0', 3) if n<x+y else (c:=n-y)*y+int(digits(c, 3)[-1::-1]or'0', 3)) # Chai Wah Wu, Jun 13 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A029803
|
|
Numbers that are palindromic in base 8.
|
|
+10
34
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 9, 18, 27, 36, 45, 54, 63, 65, 73, 81, 89, 97, 105, 113, 121, 130, 138, 146, 154, 162, 170, 178, 186, 195, 203, 211, 219, 227, 235, 243, 251, 260, 268, 276, 284, 292, 300, 308, 316, 325, 333, 341, 349, 357, 365, 373, 381, 390, 398
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 3.2188878... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 8], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
|
|
PROG
|
(Python)
from itertools import chain, count, islice
def A029803_gen(): # generator of terms
return chain((0, ), chain.from_iterable(chain((int((s:=oct(d)[2:])+s[-2::-1], 8) for d in range(8**l, 8**(l+1))), (int((s:=oct(d)[2:])+s[::-1], 8) for d in range(8**l, 8**(l+1)))) for l in count(0)))
(Python)
if n == 1: return 0
y = (x:=1<<(m:=n.bit_length()-2)-m%3)<<3
return (c:=n-x)*x+int(oct(c)[-2:1:-1]or'0', 8) if n<x+y else (c:=n-y)*y+int(oct(c)[-1:1:-1]or'0', 8) # Chai Wah Wu, Jun 13 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A029955
|
|
Palindromic in base 9.
|
|
+10
33
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 20, 30, 40, 50, 60, 70, 80, 82, 91, 100, 109, 118, 127, 136, 145, 154, 164, 173, 182, 191, 200, 209, 218, 227, 236, 246, 255, 264, 273, 282, 291, 300, 309, 318, 328, 337, 346, 355, 364, 373, 382, 391, 400, 410, 419, 428, 437
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 3.29797695... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 9], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
|
|
PROG
|
(Python)
from gmpy2 import digits
def palQgen(l, b): # generator of palindromes in base b of length <= 2*l
if l > 0:
yield 0
for x in range(1, l+1):
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[-2::-1], b)
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[::-1], b)
(Python)
from gmpy2 import digits
if n == 1: return 0
y = 9*(x:=9**(len(digits(n>>1, 9))-1))
return int((c:=n-x)*x+int(digits(c, 9)[-2::-1]or'0', 9) if n<x+y else (c:=n-y)*y+int(digits(c, 9)[-1::-1]or'0', 9)) # Chai Wah Wu, Jun 14 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A014192
|
|
Palindromes in base 4 (written in base 10).
|
|
+10
32
|
|
|
0, 1, 2, 3, 5, 10, 15, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 63, 65, 85, 105, 125, 130, 150, 170, 190, 195, 215, 235, 255, 257, 273, 289, 305, 325, 341, 357, 373, 393, 409, 425, 441, 461, 477, 493, 509, 514, 530, 546, 562, 582, 598, 614, 630, 650, 666
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Rajasekaran, Shallit, & Smith prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 2.7857715... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 4], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
pal4Q[n_]:=Module[{c=IntegerDigits[n, 4]}, c==Reverse[c]]; Select[Range[ 0, 700], pal4Q] (* Harvey P. Dale, Jul 21 2020 *)
|
|
PROG
|
(Magma) [n: n in [0..800] | Intseq(n, 4) eq Reverse(Intseq(n, 4))]; // Vincenzo Librandi, Sep 09 2015
(Python)
from gmpy2 import digits
if n == 1: return 0
y = (x:=1<<(n.bit_length()-2&-2))<<2
return (c:=n-x)*x+int(digits(c, 4)[-2::-1]or'0', 4) if n<x+y else (c:=n-y)*y+int(digits(c, 4)[-1::-1]or'0', 4) # Chai Wah Wu, Jun 14 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A029954
|
|
Palindromic in base 7.
|
|
+10
30
|
|
|
0, 1, 2, 3, 4, 5, 6, 8, 16, 24, 32, 40, 48, 50, 57, 64, 71, 78, 85, 92, 100, 107, 114, 121, 128, 135, 142, 150, 157, 164, 171, 178, 185, 192, 200, 207, 214, 221, 228, 235, 242, 250, 257, 264, 271, 278, 285, 292, 300, 307, 314, 321, 328, 335, 342, 344, 400, 456
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 3.1313768... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 7], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
pal7Q[n_]:=Module[{idn7=IntegerDigits[n, 7]}, idn7==Reverse[idn7]]; Select[ Range[0, 500], pal7Q] (* Harvey P. Dale, Jul 30 2015 *)
|
|
PROG
|
(Python)
from gmpy2 import digits
def palQgen(l, b): # generator of palindromes in base b of length <= 2*l
if l > 0:
yield 0
for x in range(1, l+1):
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[-2::-1], b)
for y in range(b**(x-1), b**x):
s = digits(y, b)
yield int(s+s[::-1], b)
(Python)
from gmpy2 import digits
from sympy import integer_log
if n == 1: return 0
y = 7*(x:=7**integer_log(n>>1, 7)[0])
return int((c:=n-x)*x+int(digits(c, 7)[-2::-1]or'0', 7) if n<x+y else (c:=n-y)*y+int(digits(c, 7)[-1::-1]or'0', 7)) # Chai Wah Wu, Jun 14 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A029953
|
|
Palindromic in base 6.
|
|
+10
28
|
|
|
0, 1, 2, 3, 4, 5, 7, 14, 21, 28, 35, 37, 43, 49, 55, 61, 67, 74, 80, 86, 92, 98, 104, 111, 117, 123, 129, 135, 141, 148, 154, 160, 166, 172, 178, 185, 191, 197, 203, 209, 215, 217, 259, 301, 343, 385, 427, 434, 476, 518, 560, 602, 644, 651, 693, 735, 777, 819
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Cilleruelo, Luca, & Baxter prove that this sequence is an additive basis of order (exactly) 3. - Charles R Greathouse IV, May 03 2020
|
|
LINKS
|
|
|
FORMULA
|
Sum_{n>=2} 1/a(n) = 3.03303318... (Phunphayap and Pongsriiam, 2019). - Amiram Eldar, Oct 17 2020
|
|
MATHEMATICA
|
f[n_, b_] := Module[{i=IntegerDigits[n, b]}, i==Reverse[i]]; lst={}; Do[If[f[n, 6], AppendTo[lst, n]], {n, 1000}]; lst (* Vladimir Joseph Stephan Orlovsky, Jul 08 2009 *)
|
|
PROG
|
(Magma) [n: n in [0..900] | Intseq(n, 6) eq Reverse(Intseq(n, 6))]; // Vincenzo Librandi, Sep 09 2015
(Python)
from gmpy2 import digits
from sympy import integer_log
if n == 1: return 0
y = 6*(x:=6**integer_log(n>>1, 6)[0])
return int((c:=n-x)*x+int(digits(c, 6)[-2::-1]or'0', 6) if n<x+y else (c:=n-y)*y+int(digits(c, 6)[-1::-1]or'0', 6)) # Chai Wah Wu, Jun 14 2024
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A097929
|
|
Numbers in base 10 that are palindromic in bases 4 and 5.
|
|
+10
22
|
|
|
0, 1, 2, 3, 46, 9222, 76449, 193662, 2347506, 2593206, 17099841, 17402241, 25651017, 32317933, 16516113567, 16619231967, 155784877126, 2806999337418, 3101308506654, 37004798195346, 47470618709562, 48517516968462
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
9222 base 10 is 2100012 base 4 and 9222 base 10 is 243342 base 5.
|
|
MATHEMATICA
|
Do[ p4 = IntegerDigits[n, 4]; If[ FromDigits[ Reverse[ p4]] == FromDigits[p4], p5 = IntegerDigits[n, 5]; If[ FromDigits[ Reverse[p5]] == FromDigits[p5], Print[n]]], {n, 2*10^7}] (* Robert G. Wilson v, Sep 07 2004 *)
|
|
PROG
|
(PARI) /* Requires reading the util.gp file in the link into the gp session. */
palbase(n, b1, b2) = { for(x=1, n, if(ispal(base(10, b1, x))& ispal(base(10, b2, x)), print1(x", ")) ) }
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A097930
|
|
Numbers in base 10 that are palindromic in bases 5 and 6.
|
|
+10
22
|
|
|
0, 1, 2, 3, 4, 67, 98, 104, 651, 2293, 3074, 26691, 27741, 704396, 723296, 755846, 883407, 48616624, 295979506, 297379006, 402327541, 198522549056, 204185363456, 240971251611, 246467321391, 303520083621, 330347455102
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
27741_10 = 1341431_5;
27741_10 = 332233_6.
|
|
MATHEMATICA
|
Do[ p5 = IntegerDigits[n, 5]; If[ FromDigits[ Reverse[ p5]] == FromDigits[p5], p6 = IntegerDigits[n, 6]; If[ FromDigits[ Reverse[p6]] == FromDigits[p6], Print[n]]], {n, 10^8}] (* Robert G. Wilson v, Sep 07 2004 *)
|
|
PROG
|
(PARI) /* Requires reading the util.gp file in the link into the gp session. */
palbase(n, b1, b2) = { for(x=1, n, if(ispal(base(10, b1, x))& ispal(base(10, b2, x)), print1(x", ")) ) }
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A249156
|
|
Palindromic in bases 5 and 7.
|
|
+10
20
|
|
|
0, 1, 2, 3, 4, 6, 24, 57, 78, 114, 342, 624, 856, 1432, 10308, 12654, 27616, 100056, 537856, 593836, 769621, 1434168, 1473368, 1636104, 1823544, 1862744, 17968646, 18108296, 22412057, 34713713, 34853363, 39280254, 159690408, 663706192
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
114 is a term since 114 = 424 base 5 and 114 = 222 base 7.
|
|
MATHEMATICA
|
palQ[n_Integer, base_Integer]:=Block[{idn=IntegerDigits[n, base]}, idn==Reverse[idn]]; Select[Range[10^6]-1, palQ[#, 5]&&palQ[#, 7]&]
|
|
PROG
|
(Python)
from gmpy2 import digits
def palQ(n, b): # check if n is a palindrome in base b
s = digits(n, b)
return s == s[::-1]
def palQgen(l, b): # unordered generator of palindromes in base b of length <= 2*l
if l > 0:
yield 0
for x in range(1, b**l):
s = digits(x, b)
yield int(s+s[-2::-1], b)
yield int(s+s[::-1], b)
A249156_list = sorted([n for n in palQgen(8, 5) if palQ(n, 7)]) # Chai Wah Wu, Nov 25 2014
(PARI) isok(n) = my(df = digits(n, 5), ds = digits(n, 7)); (Vecrev(df)==df) && (Vecrev(ds)==ds); \\ Michel Marcus, Oct 31 2017
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.017 seconds
|