login
Differential autobiographical numbers: number n = x0 x1 x2 ... x9 such that xi is the number of pairs (xj, xk), j different from k, where |xj - xk| = i.
0

%I #9 Mar 18 2015 06:03:22

%S 20404,31330

%N Differential autobiographical numbers: number n = x0 x1 x2 ... x9 such that xi is the number of pairs (xj, xk), j different from k, where |xj - xk| = i.

%C The first digit specifies how many |xj - xk| = 0 in the number, the next digit specifies how many |xj - xk| = 1, etc.

%e 31330 is in the sequence because:

%e |x0 - x2| = 0, |x0 - x3| = 0 and |x2 - x3| = 0 => x0 = 3;

%e |x1 - x3| = 1 => x1 = 1;

%e |x0 - x1| = 2, |x1 - x2| = 2 and |x1 - x3| = 2 => x2 = 3;

%e |x0 - x4| = 3, |x2 - x4| = 3 and |x3 - x4| = 3 => x2 = 3;

%e |xj - xk| = 4 does not occur for all j and k => x4 = 0.

%p for n from 10 to 10^10 do:

%p x:=convert(n,base,10):n0:=nops(x):T:=array(0..9):

%p for a from 0 to 9 do:

%p T[a]:=0:

%p od:

%p for i from 0 to 9 do:

%p for j from 1 to n0-1 do:

%p for k from j+1 to n0 do:

%p if abs(x[j]-x[k])= i

%p then

%p T[i]:=T[i]+1:

%p else

%p fi:

%p od:

%p od:

%p od:

%p s:=sum('T[m]*10^(n0-m-1)', 'm'=0..9):

%p if s=n then print(n) else fi:od:

%Y Cf. A046043, A234512.

%K nonn,base,fini,full,bref

%O 1,1

%A _Michel Lagneau_, Mar 14 2015