%I #26 Feb 26 2018 09:57:52
%S 5,6,8,9,10,11,100,114,119,120,138,380,384,396,730,767,1509,4761
%N Numbers k such that k = k_b1 - k_b2, where k_b1 and k_b2 are the representation of k in two different bases b1 < 10 and b2 < 10.
%C There are binomial(8,2) = 28 possible cases:
%C ===============================
%C Bases | Numbers
%C ----------|--------------------
%C b5 - b6 | 5, 114, 119, 120
%C b6 - b7 | 380, 384, 396
%C b7 - b8 | 730, 767, 1509
%C b8 - b9 | 4761
%C b4 - b6 | 8
%C b5 - b7 | 5
%C b6 - b8 | 100, 138
%C b4 - b7 | 6, 9
%C b5 - b8 | 5
%C b4 - b8 | 6, 10
%C b5 - b9 | 5
%C b4 - b9 | 6, 11
%C ===============================
%C All the other 16 differences do not produce any number.
%e 138 in base 6 is 350, in base 8 is 212 and 350 - 212 = 138.
%e 4761 in base 8 is 11231, in base 9 is 6470 and 11231 - 6470 = 4761.
%p # Change the value of the parameters x, y for other differences
%p with(numtheory): P:=proc(q,x,y) local b1,b2,b1x,b2x,k,n;
%p for n from 1 to q do b1:=convert(n,base,x); b2:=convert(n,base,y);
%p b1x:=0; for k from nops(b1) by -1 to 1 do b1x:=10*b1x+b1[k]; od;
%p b2x:=0; for k from nops(b2) by -1 to 1 do b2x:=10*b2x+b2[k]; od;
%p if b1x-b2x=n then print(n); fi; od; end: P(5000,8,9);
%t Select[Range[5000], Function[k, AnyTrue[Subtract @@ # & /@ Subsets[Map[FromDigits@ IntegerDigits[k, #] &, Range[2, 9]], {2}], # == k &]]] (* _Michael De Vlieger_, Feb 16 2018 *)
%Y Cf. A007088, A007089, A007090, A007091, A007092, A007093, A007094, A007095.
%K nonn,base,easy,fini,full
%O 1,1
%A _Paolo P. Lava_, Feb 15 2018
|