medie2005 发表于 2009-3-14 21:16:46

p^2=a^2&b^2

p^2=a^2&b^2(primepuzzles: puzzle 483)

I found that the following smaller primes having this property are: 7, 13, 19 & 41, because:

7^2=49=2^2&3^2
13^2= 169=4^2&3^2
19^2= 361=6^2&1^2
41^2= 1681=4^2&9^2

The largest one I found was this:

1012639687^2=1025439135687457969 = 320224786^2&3^2

Q1. Can you find larger examples?

Q2 Can you find examples (other than7^2=49=2^2&3^2) such that p, a & b are prime numbers?

Q3: Is there a larger prime than 446653271 such that all the digits of p^2 are squares?

    446653271^2= 199499144494999441 (Suggested model: p^2=a^2&b^2&c^2...z^2, a, b, ... z is 1 or 4 or 9)   

Q4. Find larger primes such that p^2=a^2&b^2&c^2...z^2 where a, b, ... z contains not necessarily just one digit as in Q3.

无心人 发表于 2009-3-14 21:33:02

:lol

怀疑这个网站的建立目的是收集站长没能力计算的各种有趣的问题
让别人帮他算

无心人 发表于 2009-3-14 21:33:47

Q3应该可以用Haskell暴力穷举

素数的开始数字是2,3,4

medie2005 发表于 2009-3-24 14:17:04

谁来解Q4?

gxqcn 发表于 2009-3-24 14:48:09

转帖网页 Squares containing at most three distinct digits 里部分结论:

37431271837881946522 = 14011001114014141144414101441441401104

436942788245669642512 = 1909190001999001011109190090109911991001

997045605978227532 = 9940999404004909449099404004499009

6480702115891070212 = 419994999149149944149149944191494441

但很遗憾,这里面平方根均为合数。

这类特殊的完全平方数本来就稀缺,还要求平方根为素数,实在是大海捞针啊!

无心人 发表于 2009-3-24 14:54:04

import ONeillPrimes(primesToLimit)

valid n = all (\x -> (x == '1') || (x == '4') || (x == '9') ) \$ show n

main = do
       letprimes_set = primesToLimit 1000000000
       letlarge_ps = filter (>= 40000000) primes_set
       letresult = [(p, n) | p <- large_ps, let n = p^2, valid n]
       print \$ show result

gxqcn 发表于 2009-3-24 15:07:13

如果把“0”算作完全平方数,我可能会找到符合要求的,
现在正在编程搜索。。。

无心人 发表于 2009-3-24 15:43:42

Q3的那个数之前的:
1:
2:
5:
然后是Q3的
18:

无心人 发表于 2009-3-24 15:45:36


#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>

mpz_t t;
unsigned int d = {1, 4, 9}, maxlvl;
mpz_t l;

int check(mpz_t n)
{
//    gmp_printf("%Zd\n", n);

    if (mpz_perfect_square_p(n))
    {
       mpz_sqrt(t, n);
       gmp_printf("[%Zd, %Zd]\n", n, t);
    }   
}

int circle(int lvl)
{
   if (lvl >= maxlvl)
   {
       check(l);
   }
   else
   for (int i = 0; i < 3; i ++ )
       {
          mpz_mul_ui(l, l, 10);
          mpz_add_ui(l, l, d);
          circle(lvl + 1);      
       }
}
int main(void)
{
int i;
mpz_init(t);
for (i = 0; i < 32; i ++)
{
    mpz_init(l);
    mpz_set_ui(l, 0);
}
printf("请输入数字长度:");
scanf("%u", &maxlvl);
for (i = 0; i < 3; i ++)
{
    mpz_set_ui(l, d);
    circle(1);
}

for (i = 0; i < 32; i ++)
    mpz_clear(l);
mpz_clear(t);
return 0;
}
是平方数的结果是凤毛麟角而已
勿论是素数平方了
所以干脆不判素性了

无心人 发表于 2009-3-24 15:47:08

比如19位的唯一的

就不是素数
页: [1] 2 3 4
查看完整版本: p^2=a^2&b^2