百科问答小站 logo
百科问答小站 font logo



x^4+y^4+z^4+w^4=a^4有正整数解吗? 第1页

  

user avatar   yu-guang-ting-92 网友的相关建议: 
      

以下是一些 的正整数解

利用多线程库在28核56线程CPU上跑大概几分钟就能出第一组解,后面的几组是在64核128线程CPU上跑了8小时找出来的。

       #include<math.h> #include<stdio.h> #include<stdlib.h> #include<threads.h>  const unsigned long NUM_THREADS = 1024; void solution(void*);  int main(){         thrd_t threads[NUM_THREADS];         for(unsigned long t=4; t<NUM_THREADS; t++){                 thrd_create(&threads[t], (thrd_start_t)solution, (void*)t);         }         thrd_exit(EXIT_SUCCESS);         return EXIT_SUCCESS; }  void solution(void* p){         long s = (long)p;         printf("%ld: pthread ID - %lu
", s, thrd_current());         for(long x=1; x<s-3; ++x){                 for(long y=x; x+y<s-2; ++y){                         for(long z=y; x+y+z<=s-z; ++z){                                 long w = s-x-y-z;                                 double d = pow(x,4)+pow(y,4)+pow(z,4)+pow(w,4);                                 if(abs(pow(round(sqrt(sqrt(d))), 4)-d)<1e-3){                                         s = (long)round(sqrt(sqrt(d)));                                         printf("%ld:	%ld	%ld	%ld	%ld
", s,x,y,z,w);                                 }                         }                 }         } }     

编译命令(文件名为main.c)

       cc main.c -lm -pthread -o main     




  

相关话题

  拓扑学能解决哪些分析学无法解决的问题? 
  优秀的程序员需要懂那些数学知识? 
  怎么在matlab中执行c语言代码,或者把c代码转换成matlab代码? 
  物理学家业余研究纯数学算不算民科? 
  1×0=0是因为0乘任何数都是0还是因为1乘任何数都是等于那个数? 
  topology 为什么被译为「拓扑」? 
  高中数学有无学习的必要? 
  如何看待涉及悉尼大学数学系教授 Williamson 和美国国家科学基金会的学术不端事件? 
  请问泰勒公式的几何意义是什么? 
  在高中,数学不好的人物理一定也不好吗? 

前一个讨论
量子力学老师提出了一个问题:为什么 Schrödinger 方程里有虚数 i ?
下一个讨论
据报道称“浏览器内核有上千万行代码”,浏览器内核真的很复杂吗?





© 2024-05-20 - tinynew.org. All Rights Reserved.
© 2024-05-20 - tinynew.org. 保留所有权利