标题: 只有一句话的、很简单的数学题(没想出来…)
性别:男-离线 djgan
(蓝色征途)

颖阳侯谏议大夫

Rank: 13Rank: 13Rank: 13Rank: 13
护军
组别 翰林学士
级别 平西将军
功绩 631
帖子 2385
编号 48898
注册 2005-9-15
家族 慕容世家


发表于 2007-3-12 14:47 资料 个人空间 短消息 看全部作者
回复 #9 天宫公主 的帖子

发现用MATLAB判断2^(2^5)是否质数会报错:

>> X=1:4

X =

     1     2     3     4

>> Y= 2.^(2.^X) +1

Y =

           5          17         257       65537

>> isprime(Y)

ans =

     1     1     1     1   %可以判断X=1,2,3,4时候,Y都是质数

>> X=1:5

X =

     1     2     3     4     5

>> Y= 2.^(2.^X) +1

Y =

  1.0e+009 *

    0.0000    0.0000    0.0000    0.0001    4.2950

>> isprime(Y)
??? Error using ==> isprime
The maximum value of X allowed is 2^32.  %2^(2^5) 就没法判断了


而且无法求2^(2^5) + 1的因子
>> factor(2^(2^5) + 1);
??? Error using ==> factor
The maximum value of n allowed is 2^32.


>>help factor
FACTOR Prime factors.
    FACTOR(N) returns a vector containing the prime factors of N.

    This function uses the simple sieve approach. It may require large
    memory allocation if the number given is too big. Technically
    it is possible to improve this algorithm, allocating less
    memory for most cases and resulting in a faster execution
    time. However, it will still have problems in the worst
    case, so we choose to impose an upper bound on the input number
    and error out for n > 2^32.

[ 本帖最后由 djgan 于 2007-3-12 14:51 编辑 ]


顶部

正在浏览此帖的会员 - 共 1 人在线




当前时区 GMT+8, 现在时间是 2025-6-22 19:44
京ICP备2023018092号 轩辕春秋 2003-2023 www.xycq.org.cn

Powered by Discuz! 5.0.0 2001-2006 Comsenz Inc.
Processed in 0.010229 second(s), 9 queries , Gzip enabled

清除 Cookies - 联系我们 - 轩辕春秋 - Archiver - WAP