login
a(n) is the smallest positive integer such that n+a(n) contains the string n-a(n), in both forward and reverse directions, as a substring. If no such number exists then a(n) = -1.
4

%I #15 Feb 05 2021 00:18:20

%S -1,-1,-1,-1,5,5,5,5,5,5,5,5,5,5,10,10,10,10,10,15,15,15,15,15,20,20,

%T 20,20,20,25,25,25,25,25,29,30,30,30,30,33,34,35,35,35,37,38,39,40,40,

%U 41,42,43,44,45,50,50,50,50,50,55,50,51,52,53,54,60,60,60,60,65,50,50,65,65,70,70,70

%N a(n) is the smallest positive integer such that n+a(n) contains the string n-a(n), in both forward and reverse directions, as a substring. If no such number exists then a(n) = -1.

%C Based on a search limit of 5*10^9 up to n = 300000 the values of n for which no a(n) is found are n = 1,2,3,4. This is likely the complete list of values for which no a(n) exists.

%C The longest run of consecutive terms with the same value in the first 300000 terms is the run of 5's at the beginning of the sequence, ten in all. This is likely the longest run for all numbers.

%H Scott R. Shannon, <a href="/A341035/a341035.png">Image of the terms for n=5..100000</a>.

%e a(5) = 5 as 5+5 = 10 which contains both 5-5 = 0 and reverse(0) = 0 as a substring.

%e a(15) = 10 as 15+10 = 25 which contains both 15-10 = 5 and reverse(5) = 5 as a substring.

%e a(61) = 50 as 61+50 = 111 which contains both 51-50 = 11 and reverse(11) = 11 as a substring.

%e a(71) = 50 as 71+50 = 121 which contains both 71-50 = 21 and reverse(21) = 12 as a substring.

%e a(1902) = 1829 as 1902+1829 = 3731 which contains both 1902-1829 = 73 and reverse(73) = 37 as a substring.

%Y Cf. A341034 (forward), A341028 (reverse), A339403, A339144, A328095, A333410, A332703.

%K sign,base

%O 1,5

%A _Scott R. Shannon_, Feb 03 2021