Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
36
Task/Eban-numbers/Mathematica/eban-numbers.math
Normal file
36
Task/Eban-numbers/Mathematica/eban-numbers.math
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
ClearAll[ZeroTwoFourSixQ, EbanNumbers]
|
||||
ZeroTwoFourSixQ[n_Integer] := (n == 0 || n == 2 || n == 4 || n == 6)
|
||||
EbanNumbers[min_, max_, show : (False | True)] :=
|
||||
Module[{counter, output, i, b, r, t, m},
|
||||
counter = 0;
|
||||
output = "";
|
||||
i = min;
|
||||
While[(i += 2) <= max,
|
||||
{b, r} = QuotientRemainder[i, 10^9];
|
||||
{m, r} = QuotientRemainder[r, 10^6];
|
||||
{t, r} = QuotientRemainder[r, 10^3];
|
||||
If[30 <= m <= 66,
|
||||
m = Mod[m, 10];
|
||||
];
|
||||
If[30 <= t <= 66,
|
||||
t = Mod[t, 10];
|
||||
];
|
||||
If[30 <= r <= 66,
|
||||
r = Mod[r, 10];
|
||||
];
|
||||
If[ZeroTwoFourSixQ[b] && ZeroTwoFourSixQ[m] && ZeroTwoFourSixQ[t] &&
|
||||
ZeroTwoFourSixQ[r],
|
||||
counter++;
|
||||
If[show,
|
||||
output = output <> ToString[i] <> " ";
|
||||
]
|
||||
]
|
||||
];
|
||||
Print[min, "-", max, ": ", output, " count = ", counter]
|
||||
]
|
||||
EbanNumbers[0, 1000, True]
|
||||
EbanNumbers[1000, 4000, True]
|
||||
EbanNumbers[0, 10^4, False]
|
||||
EbanNumbers[0, 10^5, False]
|
||||
EbanNumbers[0, 10^6, False]
|
||||
EbanNumbers[0, 10^7, False]
|
||||
Loading…
Add table
Add a link
Reference in a new issue