login
Numbers n = x0 x1...x9 such that sum of digits (mod 10) - xi == i+1 mod 10.
0

%I #12 Jun 08 2013 14:26:13

%S 21,210,765,9876,2109876,7654321,76543210,4321098765

%N Numbers n = x0 x1...x9 such that sum of digits (mod 10) - xi == i+1 mod 10.

%C We consider the system of linear equations using (mod 10):

%C x1 + x2 + x3 + ... + x9 = 1

%C x0 + x2 + x3 + ... + x9 = 2

%C x0 + x1 + x3 + ... + x9 = 3

%C ………………………….

%C x0 + x1 + ... + x7 + x9 = 9

%C x0 + x1 + x2 + ... + x8 = 0

%C where xi are the decimal digits of n.

%C For n = 2, 3,...,10 we obtain the equation Ax = b where A is the matrix with n rows and n columns, x is the vector [x0, x1,...,xp] where p = n-1, and b is the vector [1, 2,..., n] (mod 10). For n = 2, 4, 8 and 10, the solution is unique. For n = 5, 6 and 9, the system has no solution. For n = 3 and 7, the system has two solutions.

%C Properties of the sequence:

%C a(5) is the concatenation of a(2) and a(4);

%C a(2) is the suffix of a(7);

%C a(3) is the prefix of a(6) and a(7) and also the suffix of a(8);

%C a(8) contains the digits of a(4) and a(2).

%e 9876 = x0 x1 x2 x3 is in the sequence because:

%e x1 + x2 + x3 = 8+7+6 = 21 == 1 mod 10;

%e x0 + x2 + x3 = 9+7+6 = 22 == 2 mod 10;

%e x0 + x1 + x3 = 9+8+6 = 23 == 3 mod 10;

%e x0 + x1 + x2 = 9+8+7 = 24 == 4 mod 10.

%p with(numtheory):for n from 1 to 1000000 do:x:=convert(n,base,10):n1:=nops(x): s:=sum('x[i]', 'i'=1..n1):ii:=0:for k from n1 by -1 to 1 do:if irem(n1-k+1,10)=irem(s-x[k],10) then ii:=ii+1:else fi:od:if ii=n1 then print(n):else fi:od:

%K nonn,base,fini,full

%O 1,1

%A _Michel Lagneau_, Jun 08 2013