login
Integers k for which there exists an integer j such that s(k) + j + reversal(s(k) + j) = k where s(k) is the sum of digits of k.
0

%I #30 Sep 21 2022 12:58:47

%S 0,10,11,12,14,16,18,22,33,44,55,66,77,88,99,101,110,121,132,141,143,

%T 154,161,165,176,181,187,198,201,202,221,222,241,242,261,262,281,282,

%U 302,303,322,323,342,343,362,363,382,383,403,404,423,424,443,444,463

%N Integers k for which there exists an integer j such that s(k) + j + reversal(s(k) + j) = k where s(k) is the sum of digits of k.

%C Theorem: all palindromes that have an even number of digits and all palindromes that have an odd number of digits and the digit in the middle is even are in this sequence.

%H Viorel Niţică, Jeroz Makhania, <a href="https://doi.org/10.3390/sym11111374">About the Orbit Structure of Sequences of Maps of Integers</a>, Symmetry (2019), Vol. 11, No. 11, 1374.

%e k=10 is a term because a solution exists with j=4: s(10)=1, s(k) + j + reversal(s(k) + j) = 1 + 4 + reversal(1 + 4) = 10.

%t ok[n_] := Block[{s = Total@ IntegerDigits@ n}, Select[Range[0, n], s + # + FromDigits@ Reverse@ IntegerDigits[s + #] == n &, 1] != {}]; Select[ Range[0, 1000], ok] (* _Giovanni Resta_, Feb 19 2019 *)

%o (Java)

%o package com.company;

%o public class Main {

%o public static void main(String args[]) {

%o int counter=1;

%o for (int i = 0; i < 10000; i++) {

%o for (int j = 0; j < 10000; j++) {

%o int sumPlus = sumDigits(i) + j;

%o int check = sumPlus + reverse(sumPlus);

%o if (check == i) {

%o System.out.println(String.format("n(%d)=%d,a=%d", counter,i, j));

%o counter++;

%o break;

%o }

%o }

%o }

%o System.out.println(String.format("%d", counter));

%o }

%o public static int reverse(int x) {

%o String s = String.valueOf(x);

%o StringBuilder sb = new StringBuilder();

%o sb.append(s);

%o sb.reverse();

%o return Integer.parseInt(sb.toString());

%o }

%o public static int sumDigits(int x) {

%o int result = 0;

%o while (x > 0) {

%o result += x % 10;

%o x = x / 10;

%o }

%o return result;

%o }

%o }

%Y Cf. A007953 (sum of digits), A004086 (reversal).

%Y A305130 is a subsequence.

%Y This sequence is a subsequence of A067030.

%K nonn,base

%O 1,2

%A _Viorel Nitica_, Jan 06 2019

%E a(30)-a(55) from _Giovanni Resta_, Feb 19 2019