A327270 The minimum number such that the concatenation of the absolute values of differences between adjacent digits of a(n) is n. Values of n which have no such a(n) are given as -1.
10, 13, 14, 15, 16, 17, 18, 19, 90, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 133, 132, 131, 130, 137, 138, 139, 207, 208, 209, 144, 143, 142, 141, 140, 149, 306, 307, 308, 309, 155, 154, 153, 152, 151, 150, 260, 370, 408, 409, 166, 165, 164, 163, 162, 161, 160, 270
Offset: 1
Examples
a(1) = 10 as |1 - 0| = 1, and 10 is the smallest such number. a(9) = 90 as |9 - 0| = 9, and 90 is the smallest such number a(10) = 100 as |1 - 0| = 1, and |0 - 0| = 0, giving a concatenation of 10. 100 is the smallest such number. a(48) = 408 as |4 - 0| = 4 and |0 - 8| = 8, giving a concatenation of 48. 408 is the smallest such number.
Links
- Andrew Howroyd, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
max = 60; seq = Table[-1, {max}]; count = 0; n = 1; While[count < max && n <= 10^(1 + Ceiling[Log10[max]]), index = FromDigits @ Abs @ Differences @ IntegerDigits[n]; If[index <= max && seq[[index]] < 0, count++; seq[[index]] = n]; n++]; seq (* Amiram Eldar, Nov 29 2019 *)
-
PARI
A327270(n)={ my(v=if(!n, [0], digits(n))); my(recurse(k,c) = if(k>#v, c, my(d=v[k],r=-1); if(d<=c, r=self()(k+1,c-d)); if(r<0 && c+d<=9, r=self()(k+1,c+d)); if(r<0, -1, r+10^(#v+1-k)*c)) ); my(r=-1, c=1); while(r<0&&c<=9, r=recurse(1,c); c++); r } \\ Andrew Howroyd, Dec 10 2024
Comments