[go: up one dir, main page]

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!)
Search: a261423 -id:a261423
Displaying 1-10 of 86 results found. page 1 2 3 4 5 6 7 8 9
     Sort: relevance | references | number | modified | created      Format: long | short | data
A261911 Numbers n which are neither palindromes nor the sum of two palindromes, with property that the largest palindrome which when subtracted from n yields the sum of two palindromes is not the palindromic floor of n (A261423(n)), but rather the next palindrome below that. +20
4
1099, 1143, 1154, 1165, 1176, 1187, 1198, 1209, 1264, 1275, 1286, 1297, 1308, 1319, 1385, 1396, 1407, 1418, 1429, 1517, 1528, 1539, 1638, 1649, 1759, 10099, 10155, 10199, 10299, 10366, 10399, 10499, 10577, 10599, 10699, 10799, 11809, 12819, 13829, 14839 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
These are the numbers with palindromic order 4 (see A261913).
LINKS
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Sep 10 2015
STATUS
approved
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
n is a palindrome (i.e., a(k) = n for some k) if and only if n = A004086(n). - Reinhard Zumkeller, Mar 10 2002
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
This sequence is an additive basis of order at most 49, see Banks link. - Charles R Greathouse IV, Aug 23 2015
The order has been reduced from 49 to 3; see the Cilleruelo-Luca and Cilleruelo-Luca-Baxter links. - Jonathan Sondow, Nov 27 2017
See A262038 for the "next palindrome" and A261423 for the "preceding palindrome" functions. - M. F. Hasler, Sep 09 2015
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
Hunki Baek, Sejeong Bang, Dongseok Kim, and Jaeun Lee, A bijection between aperiodic palindromes and connected circulant graphs, arXiv:1412.2426 [math.CO], 2014.
William D. Banks, Derrick N. Hart, and Mayumi Sakata, Almost all palindromes are composite, Math. Res. Lett., Vol. 11, No. 5-6 (2004), pp. 853-868.
William D. Banks, Every natural number is the sum of forty-nine palindromes, arXiv:1508.04721 [math.NT], 2015; Integers, 16 (2016), article A3.
Javier Cilleruelo, Florian Luca and Lewis Baxter, Every positive integer is a sum of three palindromes, Mathematics of Computation, Vol. 87, No. 314 (2018), pp. 3023-3055, arXiv preprint, arXiv:1602.06208 [math.NT], 2017.
Patrick De Geest, World of Numbers.
Kritkhajohn Onphaeng, Tammatada Khemaratchatakumthorn, Phakhinkon Napp Phunphayap, and Prapanpong Pongsriiam, Exact Formulas for the Number of Palindromes in Certain Arithmetic Progressions, Journal of Integer Sequences, Vol. 27 (2024), Article 24.4.8. See p. 2.
Phakhinkon Phunphayap and Prapanpong Pongsriiam, Reciprocal sum of palindromes, arXiv:1803.00161 [math.CA], 2018.
Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992
Prapanpong Pongsriiam and Kittipong Subwattanachai, Exact Formulas for the Number of Palindromes up to a Given Positive Integer, Intl. J. of Math. Comp. Sci. (2019) 14:1, 27-46.
E. A. Schmidt, Positive Integer Palindromes. [Cached copy at the Wayback Machine]
Eric Weisstein's World of Mathematics, Palindromic Number.
Wikipedia, Palindromic number.
FORMULA
A136522(a(n)) = 1.
A178788(a(n)) = 0 for n > 9. - Reinhard Zumkeller, Jun 30 2010
A064834(a(n)) = 0. - Reinhard Zumkeller, Sep 18 2013
a(n+1) = A262038(a(n)+1). - M. F. Hasler, Sep 09 2015
Sum_{n>=2} 1/a(n) = A118031. - Amiram Eldar, Oct 17 2020
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
od: Res:=[Res]: # Robert Israel, Aug 10 2014
# 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:
Res; # N. J. A. Sloane, Oct 18 2015
isA002113 := proc(n)
simplify(digrev(n) = n) ;
end proc: # R. J. Mathar, Sep 09 2015
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 *)
Select[Range[10^3], PalindromeQ] (* Michael De Vlieger, Nov 27 2017 *)
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
(Python) # edited by M. F. Hasler, Jun 19 2018
def A002113_list(nMax):
mlist=[]
for n in range(nMax+1):
mstr=str(n)
if mstr==mstr[::-1]:
mlist.append(n)
return mlist # Bill McEachen, Dec 17 2010
(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])
print([next(A002113) for k in range(60)]) # Jan P. Hartkopf, Apr 10 2021
(Python) is_A002113 = lambda n: (s:=str(n))[::-1]==s # M. F. Hasler, May 23 2024
(Python)
from math import log10
def A002113(n):
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)
a002113_list = filter ((== 1) . a136522) [1..] -- Reinhard Zumkeller, Oct 09 2011
(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
(0 to 999).filter(palQ(_)) // Alonso del Arte, Nov 10 2019
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).
Palindromic primes: A002385. Palindromic nonprimes: A032350.
Palindromic-pi: A136687.
Cf. A029742 (complement), A086862 (first differences).
Palindromic floor function: A261423, also A261424. Palindromic ceiling: A262038.
Union of A056524 and A056525.
Cf. A004086 (read n backwards), A064834, A118031, A136522 (characteristic function), A178788.
Ways to write n as a sum of three palindromes: A261132, A261422.
Minimal number of palindromes that add to n using greedy algorithm: A088601.
Minimal number of palindromes that add to n: A261675.
Subsequence of A061917 and A221221.
Subsequence: A110745.
KEYWORD
nonn,base,easy,nice,core
AUTHOR
STATUS
approved
A262038 Least palindrome >= n. +10
79
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Could be called nextpalindrome() in analogy to the nextprime() function A007918. As for the latter (A151800), there is the variant "next strictly larger palindrome" which equals a(n+1), and thus differs from a(n) iff n is a palindrome; see PARI code.
Might also be called palindromic ceiling function in analogy to the name "palindromic floor" proposed for A261423.
LINKS
Eric Weisstein's World of Mathematics, Palindromic Number
MATHEMATICA
palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; Table[k = n; While[! palQ@ k, k++]; k, {n, 0, 80}] (* Michael De Vlieger, Sep 09 2015 *)
PROG
(PARI) {A262038(n, d=digits(n), p(d)=sum(i=1, #d\2, (10^(i-1)+10^(#d-i))*d[i], if(bittest(#d, 0), 10^(#d\2)*d[#d\2+1])))= for(i=(#d+3)\2, #d, d[i]>d[#d+1-i]&&break; (d[i]<d[#d+1-i]||i==#d)&&return(p(d))); n<10&&return(n); forstep(i=(#d+1)\2, 1, -1, d[i]++>9||return(p(d)); d[i]=0); 10^#d+1} \\ For a function "next strictly larger palindrome", delete the i==#d and n<10... part. - M. F. Hasler, Sep 09 2015
(Haskell)
a262038 n = a262038_list !! n
a262038_list = f 0 a002113_list where
f n ps'@(p:ps) = p : f (n + 1) (if p > n then ps' else ps)
-- Reinhard Zumkeller, Sep 16 2015
(Python)
def A262038(n):
sl = len(str(n))
l = sl>>1
if sl&1:
w = 10**l
n2 = w*10
for y in range(n//(10**l), n2):
k, m = y//10, 0
while k >= 10:
k, r = divmod(k, 10)
m = 10*m + r
z = y*w + 10*m + k
if z >= n:
return z
else:
w = 10**(l-1)
n2 = w*10
for y in range(n//(10**l), n2):
k, m = y, 0
while k >= 10:
k, r = divmod(k, 10)
m = 10*m + r
z = y*n2 + 10*m + k
if z >= n:
return z # Chai Wah Wu, Sep 14 2022
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Sep 08 2015
STATUS
approved
A206913 Greatest binary palindrome <= n; the binary palindrome floor function. +10
77
0, 1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 9, 9, 9, 9, 15, 15, 17, 17, 17, 17, 21, 21, 21, 21, 21, 21, 27, 27, 27, 27, 31, 31, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 45, 45, 45, 45, 45, 45, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 63, 63, 65, 65, 65, 65 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
Also the greatest binary palindrome < n + 1;
For n > 0, a(n-1) is the greatest binary palindrome < n.
LINKS
FORMULA
Let n > 2, p = 1 + 2*floor((n-1)/2), m = floor(log_2(p)), q = floor((m+1)/2), s = floor(log_2(p-2^q)),
F(x, r) = floor(x/2^q)*2^q + Sum_{k = 0...q - 1} (floor(x/2^(r-k)) mod 2)*2^k;
If F(p, m) <= n then a(n) = F(p, m), otherwise a(n) = F(p-2^q, s).
By definition: F(p, m) = floor(p/2^q)*2^q + A030101(p) mod 2^q; also: F(p-2^q, s) = floor((p-2^q)/2^q)*2^q + A030101(p-2^q) mod 2^q; [Edited and corrected by Hieronymus Fischer, Sep 08 2018]
a(n) = A006995(A206915(n));
a(n) = A006995(A206915(A206914(n+1))-1);
a(n) = A006995(A206916(A206914(n+1))-1).
EXAMPLE
a(0) = 0 since 0 is the greatest binary palindrome <= 0;
a(1) = 1 since 1 is the greatest binary palindrome <= 1;
a(2) = 1 since 1 is the greatest binary palindrome <= 2;
a(3) = 3 since 3 is the greatest binary palindrome <= 3.
PROG
(Haskell)
a206913 n = last $ takeWhile (<= n) a006995_list
-- Reinhard Zumkeller, Feb 27 2012
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Feb 13 2012
STATUS
approved
A175298 Smallest number >=n whose binary representation is palindromic and has a 1 whenever the binary representation of n has a 1. +10
76
0, 1, 3, 3, 5, 5, 7, 7, 9, 9, 15, 15, 15, 15, 15, 15, 17, 17, 27, 27, 21, 21, 31, 31, 27, 27, 27, 27, 31, 31, 31, 31, 33, 33, 51, 51, 45, 45, 63, 63, 45, 45, 63, 63, 45, 45, 63, 63, 51, 51, 51, 51, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 99, 99, 85, 85, 119, 119, 73 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Old name: "Convert n to binary. OR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result."
By "respective" digits of binary n and binary A030101(n), the rightmost digit of A030101(n) ( which is a 1) is OR'ed with the rightmost digit of n. A030101(n) is represented with the appropriate number of leading 0's.
This is the binary next-palindrome function, the base-2 analog of A262038. - N. J. A. Sloane, Dec 08 2015
LINKS
EXAMPLE
20 in binary is 10100. The reversal of the binary digits is 00101. So, from leftmost to rightmost respective digits, we OR 10100 and 00101: 1 OR 0 = 1. 0 OR 0 = 0. 1 OR 1 = 1. 0 OR 0 = 0. And 0 OR 1 = 1. So, 10100 OR 00101 is 10101, which is 21 in decimal. So a(20) = 21.
MATHEMATICA
Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[Positive[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT, ENDPOINT}] (* Dylan Hamilton, Oct 15 2010 *)
f[n_] := Block[{id = IntegerDigits[n, 2]}, FromDigits[ BitOr[ id, Reverse@id], 2]]; Array[f, 72] (* Robert G. Wilson v, Nov 07 2010 *)
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Mar 24 2010
EXTENSIONS
Extended, with redundant initial entries included, by Dylan Hamilton, Oct 15 2010
Edited with new name and offset by N. J. A. Sloane, Dec 08 2015
STATUS
approved
A206914 Least binary palindrome >= n; the binary palindrome ceiling function. +10
75
0, 1, 3, 3, 5, 5, 7, 7, 9, 9, 15, 15, 15, 15, 15, 15, 17, 17, 21, 21, 21, 21, 27, 27, 27, 27, 27, 27, 31, 31, 31, 31, 33, 33, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 51, 51, 51, 51, 51, 51, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 65, 65, 73, 73 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
For n > 0 also the least binary palindrome > n - 1;
a(n+1) is the least binary palindrome > n
LINKS
FORMULA
a(n) = A006995(A206916(n));
a(n) = A006995(A206916(A206913(n-1))+1);
a(n) = A006995(A206915(A206913(n-1))+1);
EXAMPLE
a(0) = 0 since 0 is the least binary palindrome >= 0;
a(1) = 1 since 1 is the least binary palindrome >= 1;
a(2) = 3 since 3 is the least binary palindrome >= 2;
a(5) = 5 since 5 is the least binary palindrome >= 5;
PROG
(Haskell)
a206914 n = head $ dropWhile (< n) a006995_list
-- Reinhard Zumkeller, Feb 27 2012
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
KEYWORD
nonn,base
AUTHOR
Hieronymus Fischer, Feb 15 2012
STATUS
approved
A265509 a(n) = largest base-2 palindrome m <= 2n+1 such that every base-2 digit of m is <= the corresponding digit of 2n+1; m is written in base 10. +10
70
1, 3, 5, 7, 9, 9, 9, 15, 17, 17, 21, 21, 17, 27, 21, 31, 33, 33, 33, 33, 33, 33, 45, 45, 33, 51, 33, 51, 33, 51, 45, 63, 65, 65, 65, 65, 73, 73, 73, 73, 65, 65, 85, 85, 73, 73, 93, 93, 65, 99, 65, 99, 73, 107, 73, 107, 65, 99, 85, 119, 73, 107, 93, 127, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 153 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
COMMENTS
A007088(a(n)) = A265510(n). - Reinhard Zumkeller, Dec 11 2015
LINKS
MAPLE
ispal := proc(n) # test for base-b palindrome
local L, Ln, i;
global b;
L := convert(n, base, b);
Ln := nops(L);
for i to floor(1/2*Ln) do
if L[i] <> L[Ln + 1 - i] then return false end if
end do;
return true
end proc
# find max pal <= n and in base-b shadow of n, write in base 10
under10:=proc(n) global b;
local t1, t2, i, m, sw1, L2;
if n mod b = 0 then return(0); fi;
t1:=convert(n, base, b);
for m from n by -1 to 0 do
if ispal(m) then
t2:=convert(m, base, b);
L2:=nops(t2);
sw1:=1;
for i from 1 to L2 do
if t2[i] > t1[i] then sw1:=-1; break; fi;
od:
if sw1=1 then return(m); fi;
fi;
od;
end proc;
b:=2; [seq(under10(2*n+1), n=0..144)]; # Gives A265509
# find max pal <= n and in base-b shadow of n, write in base b
underb:=proc(n) global b;
local t1, t2, i, m, mb, sw1, L2;
if n mod b = 0 then return(0); fi;
t1:=convert(n, base, b);
for m from n by -1 to 0 do
if ispal(m) then
t2:=convert(m, base, b);
L2:=nops(t2);
sw1:=1;
for i from 1 to L2 do
if t2[i] > t1[i] then sw1:=-1; break; fi;
od:
if sw1=1 then mb:=add(t2[i]*10^(i-1), i=1..L2); return(mb); fi;
fi;
od;
end proc;
b:=2; [seq(underb(2*n+1), n=0..144)]; # Gives A265510
MATHEMATICA
A265509 = FromDigits[Min /@ Transpose[{#, Reverse@#}], 2] &@IntegerDigits[2 # + 1, 2] & (* JungHwan Min, Aug 22 2016 *)
PROG
(Haskell)
a265509 n = a265509_list !! n
a265509_list = f (tail a030308_tabf) [[]] where
f (bs:_:bss) pss = y : f bss pss' where
y = foldr (\d v -> 2 * v + d) 0 ys
(ys:_) = dropWhile (\ps -> not $ and $ zipWith (<=) ps bs) pss'
pss' = if bs /= reverse bs then pss else bs : pss
-- Reinhard Zumkeller, Dec 11 2015
CROSSREFS
Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
KEYWORD
nonn,base,look
AUTHOR
N. J. A. Sloane, Dec 09 2015
STATUS
approved
A035137 Numbers that are not the sum of 2 palindromes (where 0 is considered a palindrome). +10
21
21, 32, 43, 54, 65, 76, 87, 98, 201, 1031, 1041, 1042, 1051, 1052, 1053, 1061, 1062, 1063, 1064, 1071, 1072, 1073, 1074, 1075, 1081, 1082, 1083, 1084, 1085, 1086, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1099, 1101, 1103, 1104, 1105, 1106, 1107, 1108 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Apparently, every positive number is equal to the sum of at most 3 positive palindromes. - Giovanni Resta, May 12 2013
A260254(a(n)) = 0. - Reinhard Zumkeller, Jul 21 2015
A261675(a(n)) >= 3 (and, conjecturally, = 3). - N. J. A. Sloane, Sep 03 2015
This sequence is infinite. Proof: It is easy to see that 200...01 (with any number of zeros) cannot be the sum of two palindromes. - N. J. A. Sloane, Sep 03 2015
The conjecture that every number is the sum of 3 palindromes fails iff there is a term a(n) such that for all palindromes P < a(n), the difference a(n) - P is also a term of this sequence. - M. F. Hasler, Sep 08 2015
Cilleruelo and Luca (see links) have proved the conjecture that every positive integer is the sum of at most three palindromes (in bases >= 5), and also that the density of those that require three is positive. - Christopher E. Thompson, Apr 14 2016
LINKS
Javier Cilleruelo and Florian Luca, Every positive integer is a sum of three palindromes, arXiv:1602.06208 [math.NT], 2016.
P. De Geest, World!Of Numbers
Hugo Pfoertner, Plot of first 10^6 terms
Eric Weisstein's World of Mathematics, Palindromic Number
MAPLE
N:= 4: # to get all terms with <= N digits
revdigs:= proc(n) local L, j, nL;
L:= convert(n, base, 10); nL:= nops(L);
add(L[j]*10^(nL-j), j=1..nL);
end proc;
palis:= $0..9:
for d from 2 to N do
if d::even then
palis:= palis, seq(x*10^(d/2)+revdigs(x), x=10^(d/2-1)..10^(d/2)-1)
else
palis:= palis, seq(seq(x*10^((d+1)/2)+y*10^((d-1)/2)+revdigs(x), y=0..9), x=10^((d-3)/2)..10^((d-1)/2)-1);
fi
od:
palis:= [palis]:
A:= Array(0..10^N-1):
A[palis]:= 1:
B:= SignalProcessing:-Convolution(A, A):
select(t -> B[t+1] < 0.5, [$1..10^N-1]); # Robert Israel, Jun 22 2015
MATHEMATICA
palQ[n_]:=FromDigits[Reverse[IntegerDigits[n]]]==n; nn=1108; t={}; Do[i=c=0; While[i<=n && c!=1, If[palQ[i] && palQ[n-i], AppendTo[t, n]; c=1]; i++], {n, nn}]; Complement[Range[nn], t] (* Jayanta Basu, May 12 2013 *)
PROG
(Haskell)
a035137 n = a035137_list !! (n-1)
a035137_list = filter ((== 0) . a260254) [0..]
-- Reinhard Zumkeller, Jul 21 2015
(PARI) is_A035137(n)={my(k=0); !until(n<2*k=nxt(k), is_A002113(n-k)&&return)} \\ Uses function nxt() given in A002113. Not very efficient for large n, better start with k=n-A261423(n). Maybe also better use A261423 rather than nxt(). - M. F. Hasler, Jul 21 2015
CROSSREFS
Cf. A260254, A260255 (complement), A002113, A261906, A261907.
Cf. A319477 (disallowing zero).
KEYWORD
nonn,base
AUTHOR
Patrick De Geest, Nov 15 1998
STATUS
approved
A088601 Number of steps to reach 0 when iterating A261424(x) = x - (the largest palindrome less than x), starting at n. +10
9
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 1, 2, 2, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,10
COMMENTS
The sequence "minimum number of palindromes that sum up to n", A261675, coincides with this sequence up to a(301). But then a(302) = 3 since 302 = 292 + 9 + 1, whereas 302 = 111 + 191.
While it has been conjectured [proved by Cilleruelo & Luca, 2016 -Ed.] that every number can be represented as a sum of at most 3 palindromes, the terms of this sequence, which correspond to a greedy representation, can be larger than 3 (see A109326). For example, 1022 can be represented as 33 + 989, but a(1022) = 4, because the greedy decomposition gives 1022 = 1001 + 11 + 9 + 1. - Giovanni Resta, Aug 20 2015
Presumably this sequence is unbounded (compare A109326). - N. J. A. Sloane, Sep 02 2015
This sequence is unbounded. Let n(1) := 1. To construct n(j+1), take a natural number m with 10^m > n(j) and set n(j+1) := 10^(2m) + 1 + n(j). Then a(n(j)) = j. - Markus Sigg, Oct 26 2015
In A109326 an explicit formula for a smaller (conjectured sharp) upper bound was already given earlier. - M. F. Hasler, Sep 09 2018
LINKS
William D. Banks, Every natural number is the sum of forty-nine palindromes, arXiv:1508.04721 [math.NT], 2015 and INTEGERS 16 (2016) A3
Javier Cilleruelo, Florian Luca and Lewis Baxter, Every positive integer is a sum of three palindromes, arXiv:1602.06208 [math.NT], 2016-2017.
M. F. Hasler, Sum of palindromes, OEIS wiki, Sept. 2015
Markus Sigg, On a conjecture of John Hoffman regarding sums of palindromic numbers, arXiv:1510.07507 [math.NT], 2015.
FORMULA
a(n) < log_2(log_10(n)) + 3. - M. F. Hasler, Sep 09 2018
EXAMPLE
a(10) = 2: f(10) = 10-9 = 1, f(1) = 1-1 = 0, two steps.
MAPLE
# From N. J. A. Sloane, Aug 28 2015
# P has list of palindromes
palfloor:=proc(n) global P; local i;
for i from 1 to nops(P) do
if P[i]=n then return(n); fi;
if P[i]>n then return(P[i-1]); fi;
od:
end;
GA:=proc(n) global P, palfloor; local a, i, k;
a:=1; k:=n;
for i from 1 to 30 do
if k-palfloor(k)=0 then return(a);
else k:=k-palfloor(k); a:=a+1; fi;
od; end;
[seq(GA(n), n=0..200)];
MATHEMATICA
Length@ NestWhileList[f, #, # > 0 &] & /@ Range@ 105 - 1 (* Michael De Vlieger, Oct 26 2015 *)
PROG
(PARI) ispal(n) = my(d=digits(n)); Vecrev(d)==d;
fp(n) = {while(!ispal(n), n--); n; }
a(n) = {nb = 0; while (n, n -= fp(n); nb++); nb; } \\ Michel Marcus, Aug 20 2015
/* The above fp() is extremely inefficient already for mid-sized numbers. The PARI function A261423 should be preferred.*/
(PARI) A088601(n)=for(i=1, oo, (n-=A261423(n))||return(i)) \\ M. F. Hasler, Sep 09 2018
(Python)
def P(n):
s = str(n); h = s[:(len(s)+1)//2]; return int(h + h[-1-len(s)%2::-1])
def A261423(n):
s = str(n)
if s == '1'+'0'*(len(s)-1) and n > 1: return n - 1
Pn = P(n)
return Pn if Pn <= n else P(n - 10**(len(s)//2))
def A088601(n): return 0 if n == 0 else 1 + A088601(n - A261423(n))
print([A088601(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 12 2021
CROSSREFS
Cf. A109326 gives index of first occurrence of n in this sequence ("greedy inverse").
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy, Oct 13 2003
EXTENSIONS
More terms from David Wasserman, Aug 11 2005
STATUS
approved
A261424 Difference between n and the largest palindrome <= n. +10
7
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,14
COMMENTS
Up to a(301), this is the same as the sequence b(n) = least palindrome to be subtracted from n such that the difference is again a palindrome, or 10 if no such palindrome exists. But a(302) = 10 (= 302 - 292), while b(302) = 111 is the smallest palindrome P such that 302 - P is again a palindrome, 302 - 111 = 191. Similarly, b(403) = ... = b(908) = 111. For n = 1011, 1012, ..., 1110 one has a(n) = n - 1001 = 10, 11, 12, ..., 109 while b(n) = 22, 11, 44, 55, ..., 99, b(1019) = 121, b(1020) = 101, b(1021) = 22, 33, ..., 99, b(1029) = 131, 101, 10, 33, 44, ... and so on. - M. F. Hasler, Sep 08 2015
A further sequence which starts with the same values is c(n) = n-p, where p is the largest palindrome <= n such that n-p is the sum of m-1 palindromes, where m = A261675(n) is the minimal number of palindromes that add up to n. This means that c(n) = 0 (= a(n) = b(n)) if n is a palindrome; if n is the sum of 2 palindromes, then c(n) = b(n) is the smallest palindrome such that n - c(n) is again a palindrome; if n is the sum of three palindromes, then c(n) is the smallest possible sum of two palindromes such that n - c(n) is the largest possible palindrome. The numbers with A261675(n) = 3 are listed in A035137. Here, n = 1099 is the first index for which c(n) = 100 (= 99 + 1 and 1099 - 100 = 999) differs from a(n) = n - 1001 = 98 and from b(n) = 10. - M. F. Hasler, Sep 11 2015
LINKS
FORMULA
a(n) = n - A261423(n). - M. F. Hasler, Sep 11 2015
MAPLE
# P has list of palindromes
palfloor:=proc(n) global P; local i;
for i from 1 to nops(P) do
if P[i]=n then return(n); fi;
if P[i]>n then return(P[i-1]); fi;
od:
end;
[seq(n-palfloor(n), n=0..200)];
MATHEMATICA
palQ[n_] := Block[{d = IntegerDigits@ n}, d == Reverse@ d]; Table[k = n;
While[Nand[palQ@ k, k > -1], k--]; n - k, {n, 0, 86}] (* Michael De Vlieger, Sep 09 2015 *)
CROSSREFS
KEYWORD
nonn,base,look
AUTHOR
N. J. A. Sloane, Aug 28 2015
STATUS
approved
page 1 2 3 4 5 6 7 8 9

Search completed in 0.028 seconds

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 August 29 11:24 EDT 2024. Contains 375516 sequences. (Running on oeis4.)