[go: up one dir, main page]

login
A323190
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
0, 10, 11, 12, 14, 16, 18, 22, 33, 44, 55, 66, 77, 88, 99, 101, 110, 121, 132, 141, 143, 154, 161, 165, 176, 181, 187, 198, 201, 202, 221, 222, 241, 242, 261, 262, 281, 282, 302, 303, 322, 323, 342, 343, 362, 363, 382, 383, 403, 404, 423, 424, 443, 444, 463
OFFSET
1,2
COMMENTS
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.
LINKS
Viorel Niţică, Jeroz Makhania, About the Orbit Structure of Sequences of Maps of Integers, Symmetry (2019), Vol. 11, No. 11, 1374.
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(Java)
package com.company;
public class Main {
public static void main(String args[]) {
int counter=1;
for (int i = 0; i < 10000; i++) {
for (int j = 0; j < 10000; j++) {
int sumPlus = sumDigits(i) + j;
int check = sumPlus + reverse(sumPlus);
if (check == i) {
System.out.println(String.format("n(%d)=%d, a=%d", counter, i, j));
counter++;
break;
}
}
}
System.out.println(String.format("%d", counter));
}
public static int reverse(int x) {
String s = String.valueOf(x);
StringBuilder sb = new StringBuilder();
sb.append(s);
sb.reverse();
return Integer.parseInt(sb.toString());
}
public static int sumDigits(int x) {
int result = 0;
while (x > 0) {
result += x % 10;
x = x / 10;
}
return result;
}
}
CROSSREFS
Cf. A007953 (sum of digits), A004086 (reversal).
A305130 is a subsequence.
This sequence is a subsequence of A067030.
Sequence in context: A031089 A110186 A098945 * A046431 A108697 A109279
KEYWORD
nonn,base
AUTHOR
Viorel Nitica, Jan 06 2019
EXTENSIONS
a(30)-a(55) from Giovanni Resta, Feb 19 2019
STATUS
approved