葡萄糖 发表于 2014-5-17 09:29:52

乘法宫格

\(\Huge\begin{align*}   
\square\square\\
\underline{\times\square\square\square}\\
\square\square\square\square\\
\end{align*}\)
在每个空格处填上1~9个数字中的一个数字,要求不重复,有多少种填法?


\(\Huge\begin{align*}   
\square\square\\
\underline{\times\square\square\square}\\
\square\square\square\square\square\\
\end{align*}\)
在每个空格处填上0~9个数字中的一个数字,要求不重复,有多少种填法?

kastin 发表于 2014-5-20 22:17:01

第一个问题Matlab代码:
a=perms(1:9);
A=100*a(:,1)+10*a(:,2)+a(:,3);
B=10*a(:,4)+a(:,5);
C=1000*a(:,6)+100*a(:,7)+10*a(:,8)+a(:,9);
idx=A.*B==C;
fprintf('\n%3d*%2d=%4d\n',')
共7组解
483*12=5796

297*18=5346

186*39=7254

157*28=4396

159*48=7632

138*42=5796

198*27=5346

wayne 发表于 2014-5-20 23:58:34

$ nc 192.168.1.100 -p 8888 4444 -l
Mathematica 9.0 for Linux x86 (64-bit)
Copyright 1988-2013 Wolfram Research, Inc.

In:= $Version
Out= 9.0 for Linux x86 (64-bit) (February 7, 2013)

In:= SystemInformation[][]
Out= ReleaseID -> 9.0.1.0 (4092720, 4092445)

In:= Select]], FromDigits]],
   FromDigits]]*FromDigits]]}, {i,Permutations, {5}]}],
Sort] == Range &]

Out= {{12, 483, 5796}, {18, 297, 5346}, {27, 198, 5346}, {28, 157, 4396}, {39, 186, 7254}, {42, 138, 5796}, {48, 159, 7632}}

In:=
In:= Select]], FromDigits]],
   FromDigits]]*FromDigits]]}, {i,
   Permutations, {5}]}],
Sort] == Range &]

Out= {{27, 594, 16038}, {36, 495, 17820}, {39, 402, 15678}, {45, 396, 17820}, {46, 715, 32890}, {52, 367, 19084}, {54, 297, 16038}, {63, 927, 58401}, {78, 345, 26910}}

In:= ^C$
$ uname -a
Linux alarmpi 3.12.20-1-ARCH #1 PREEMPT Sun May 18 12:13:26 MDT 2014 armv6l GNU/Linux

kastin 发表于 2014-5-21 09:47:36

如果第二问的0不能出现在乘数被乘数和积首位
clear, clc
a=perms(1:9);
for k=
    b=;
    A=100*b(:,1)+10*b(:,2)+b(:,3);
    B=10*b(:,4)+b(:,5);
    C=10000*b(:,6)+1000*b(:,7)+100*b(:,8)+10*b(:,9)+b(:,10);
    idx=A.*B==C;
    if any(idx), fprintf('\n%3d*%2d=%4d\n','); end
end
402*39=15678

594*27=16038

367*52=19084

297*54=16038

927*63=58401

715*46=32890

495*36=17820

345*78=26910

396*45=17820

cn8888 发表于 2014-5-21 13:49:14

http://bbs.emath.ac.cn/forum.php?mod=viewthread&tid=4262&highlight=%D0%A1%D1%A7%B0%C2%CA%FD
小学奥数求助

cn8888 发表于 2014-5-21 13:59:17

Clear["Global`*"];(*Clear all variables*)Do[c = a*b;(*两个整数的乘积*)
U = Union[IntegerDigits@a, IntegerDigits@b,
   IntegerDigits@c];(*求出a\b\c三个整数的各个位数,然后取并集*)
If[U == {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} && c < 99999 &&
   c > 11111,(*要求并集之后为 {1,2,3,4,5,6,7,8,9},并且c是四位数*)
Print[{a, b, c}]],(*如果达到上面的两个了要求,就打印出三个整数*){a, 11, 99},(*第一个整数*){b,
111, 999}]


{27,594,16038}

{36,495,17820}

{39,402,15678}

{45,396,17820}

{46,715,32890}

{52,367,19084}

{54,297,16038}

{63,927,58401}

{78,345,26910}

cn8888 发表于 2014-5-21 14:08:50

Do,Print@{a,b,c}],{a,11,99},{b,111,999}]

第二个问题
{27,594,16038}

{36,495,17820}

{39,402,15678}

{45,396,17820}

{46,715,32890}

{52,367,19084}

{54,297,16038}

{63,927,58401}

{78,345,26910}

Do&&c<9999,Print@{a,b,c}],{a,11,99},{b,111,999}]


{12,483,5796}

{18,297,5346}

{27,198,5346}

{28,157,4396}

{39,186,7254}

{42,138,5796}

{48,159,7632}
上面是第一个问题

cn8888 发表于 2014-5-21 14:11:14

你真牛逼,居然会用latex搞这个正方形!牛!!!!!!!!!!!!
:)

cn8888 发表于 2014-5-21 14:13:40

\(\Huge\begin{align*}   
\square\square\\   
\underline{\times\square\square\square}\\   
\square\square\square\square\square\square\square\square\square\square\square\square\square\square\square\square\square\square\square\\   
\end{align*}\)
测试一下看行不行?
楼主能把答案也用latex表达出来吗?带矩形框封闭数字的那种
页: [1]
查看完整版本: 乘法宫格