cp's OEIS Frontend

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.

Showing 1-1 of 1 results.

A244552 Palindromes j such that j +- the sum of digits of j are both palindromes.

Original entry on oeis.org

1, 2, 3, 4, 181, 262, 343, 424, 767, 848, 929
Offset: 1

Views

Author

Derek Orr, Jun 29 2014

Keywords

Comments

This sequence is finite. For any j, the largest digit sum possible is 9*A055642(j). Let j contain M digits. In order for j to be a palindrome and j + digsum(j) to be a palindrome, if digsum(j) affects the k-th digit of j, it must also affect the (M-k)-th digit of j for k = 1, 2, ..., M-1. For example, if j is 5 digits long and digsum(j) is 2 digits long, then j + digsum(j) and j - digsum(j) must affect the digit in the thousands place of j in order to produce a palindrome. This means that digsum(j) must be at least 4 digits long. Generally, we can say that A055642(digsum(j)) >= A055642(j) - A055642(digsum(j)) + 1 and thus, A055642(digsum(j)) >= (1/2)*(A055642(j)+1). This, however, fails when j > 3 digits. When j is 4 digits, the maximum that the digit sum could be is 36, a 2-digit number. Since it is a 2-digit number, it must affect the digit in the hundreds place of j when it is added to or subtracted from j. However, this is not possible since digsum(j) is only 2 digits long. For j > 4 digits the argument is similar.

Examples

			181 is a palindrome, 181 + (1+8+1) = 191 is a palindrome, and 181 - (1+8+1) = 171 is a palindrome. Thus 181 is a member of this sequence.
		

Crossrefs

Programs

  • Mathematica
    palQ[n_]:=Module[{t=Total[IntegerDigits[n]]},AllTrue[{n,n+t,n-t}, PalindromeQ]]; Select[Range[1000],palQ] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 23 2018 *)
  • PARI
    rev(n)={r="";for(i=1,#digits(n),r=concat(Str(digits(n)[i]),r));return(eval(r))}
    for(n=1,10^7,if(rev(n)==n,dig=digits(n);s=sum(k=1,#dig,dig[k]);sm=n-s;la=n+s;if(rev(sm)==sm&&rev(la)==la,print1(n,", "))))
Showing 1-1 of 1 results.