• There is no Zero in Mathematics Digits Riddle

    From Mostowski Collapse@21:1/5 to All on Tue Sep 21 11:40:18 2021
    Its nearly autumn. Time to refresh your Prolog or CLP(FD) skills.

    This gives me:

    ?- X is 10^10//81-1.
    X = 123456789.

    So the expression delivers a number with all non-zero
    digits. Is there another formula that delivers all digits,
    possibly permuted, where the formula itself has no zero in it?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Tue Sep 21 12:21:39 2021
    SWI-Prolog gives me:

    ?- use_module(library(clpfd)).
    true.

    ?- [D1,D2,D3,D4,D5,D6,D7,D8,D9] ins 1..9,
    [A,B,C] ins 2..9\/11..15,
    A^B*C #= (((((((D1*10+D2)*10+D3)*10+D4)*10+D5)*10+D6)*10+D7)*10+D8)*10+D9,
    all_different([D1,D2,D3,D4,D5,D6,D7,D8,D9]),
    label([A,B,C,D1,D2,D3,D4,D5,D6,D7,D8,D9]).
    D1 = C, C = 9,
    D2 = 4,
    D3 = 8,
    D4 = B, B = 7,
    D5 = 2,
    D6 = 1,
    D7 = 5,
    D8 = 3,
    D9 = 6,
    N = 948721536,
    A = 14 ;
    false.

    ?- X is 14^7*9.
    X = 948721536.

    LoL

    Mostowski Collapse schrieb am Dienstag, 21. September 2021 um 20:40:19 UTC+2:
    Its nearly autumn. Time to refresh your Prolog or CLP(FD) skills.

    This gives me:

    ?- X is 10^10//81-1.
    X = 123456789.

    So the expression delivers a number with all non-zero
    digits. Is there another formula that delivers all digits,
    possibly permuted, where the formula itself has no zero in it?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)