找回密码
 欢迎注册
查看: 29375|回复: 30

[讨论] p^2=a^2&b^2

[复制链接]
发表于 2009-3-14 21:16:46 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?欢迎注册

×
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 than  7^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 | 显示全部楼层


怀疑这个网站的建立目的是收集站长没能力计算的各种有趣的问题
让别人帮他算
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-3-14 21:33:47 | 显示全部楼层
Q3应该可以用Haskell暴力穷举

素数的开始数字是2,3,4
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
 楼主| 发表于 2009-3-24 14:17:04 | 显示全部楼层
谁来解Q4?
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 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
       let  primes_set = primesToLimit 1000000000
       let  large_ps = filter (>= 40000000) primes_set
       let  result = [(p, n) | p <- large_ps, let n = p^2, valid n]
       print \$ show result
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-3-24 15:07:13 | 显示全部楼层
如果把“0”算作完全平方数,我可能会找到符合要求的,
现在正在编程搜索。。。
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-3-24 15:43:42 | 显示全部楼层
Q3的那个数之前的:
1: [9, 3]
2: [49, 7]
5: [11449, 107]
然后是Q3的
18:  [199499144494999441, 446653271]
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-3-24 15:45:36 | 显示全部楼层

  1. #include <gmp.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>

  4. mpz_t t;
  5. unsigned int d[3] = {1, 4, 9}, maxlvl;
  6. mpz_t l[32];

  7. int check(mpz_t n)
  8. {
  9. //    gmp_printf("%Zd\n", n);

  10.     if (mpz_perfect_square_p(n))
  11.     {
  12.        mpz_sqrt(t, n);
  13.        gmp_printf("[%Zd, %Zd]\n", n, t);
  14.     }     
  15. }

  16. int circle(int lvl)
  17. {
  18.    if (lvl >= maxlvl)
  19.      {
  20.        check(l[lvl-1]);
  21.      }
  22.      else
  23.      for (int i = 0; i < 3; i ++ )
  24.        {
  25.           mpz_mul_ui(l[lvl], l[lvl-1], 10);
  26.           mpz_add_ui(l[lvl], l[lvl], d[i]);
  27.           circle(lvl + 1);        
  28.        }
  29. }
  30. int main(void)
  31. {
  32.   int i;
  33.   mpz_init(t);
  34.   for (i = 0; i < 32; i ++)
  35.   {
  36.     mpz_init(l[i]);
  37.     mpz_set_ui(l[i], 0);
  38.   }
  39.   printf("请输入数字长度:");
  40.   scanf("%u", &maxlvl);
  41.   for (i = 0; i < 3; i ++)
  42.   {  
  43.     mpz_set_ui(l[0], d[i]);
  44.     circle(1);
  45.   }

  46.   for (i = 0; i < 32; i ++)
  47.     mpz_clear(l[i]);
  48.   mpz_clear(t);
  49.   return 0;
  50. }
复制代码
是平方数的结果是凤毛麟角而已
勿论是素数平方了
所以干脆不判素性了
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
发表于 2009-3-24 15:47:08 | 显示全部楼层
比如19位的唯一的
[9914419419914449449, 3148717107]
就不是素数
毋因群疑而阻独见  毋任己意而废人言
毋私小惠而伤大体  毋借公论以快私情
您需要登录后才可以回帖 登录 | 欢迎注册

本版积分规则

小黑屋|手机版|数学研发网 ( 苏ICP备07505100号 )

GMT+8, 2024-5-9 08:01 , Processed in 0.047599 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表