From 43949f66df17a3dd38fe555afe077cde2aec6553 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Thu, 14 Jul 2022 14:10:50 +0000 Subject: [PATCH] Solved 3 Co-authored-by: sigonasr2 --- archives/2/current | Bin 0 -> 16752 bytes archives/3/current | Bin 0 -> 16752 bytes archives/3/src/main.c | 55 +++++++++++++++++++++++++++++++++++++ current | Bin 16752 -> 16752 bytes src/main.c | 61 +++++++++++++++++++++++++++++------------- 5 files changed, 98 insertions(+), 18 deletions(-) create mode 100755 archives/2/current create mode 100755 archives/3/current create mode 100644 archives/3/src/main.c diff --git a/archives/2/current b/archives/2/current new file mode 100755 index 0000000000000000000000000000000000000000..00f3df176e8ad5eec22e9ce50a12dd4273a13b7b GIT binary patch literal 16752 zcmeHOZ)_aJ6`#Aa6DK5Rha|)a6mNk@3CNdoFs?&!xpQo1-8zX$>;f%ebM~F%6TUn5 zZVzHwXpk|@$uW(nX!$_ZB2{Xo{*fzzL_efBO`A}uREbnop{Q+28{tr(Nq{Q-lWc!) zcHVh+eWvQ44}92>_I~qz^WK};H?w;)cQaq??CA;y0)kUWd_s_Ppw4Dus$hDH$^c@b zRV>G6gScKSf?OpzyF6wCO6_zy=*Akwhk#^PPnimMolOfyZXqGrEtKw|1|cyDbsuC` zO$AE!Vy9{cBbS%!)5sV}lb>ZACIuu$ryVtAx=|L3={7g+RdE?s$aW->-HfuEQFe^y zReg*cPl^d$t?E9!sG*FKCO?Jn+TEk-3TvoJ&au6 zU9eMKYa9NXPwwVjs=kH#p;yJ9QH57*8c7edG;bP7HjbpT#r=)@TU#1inj?i=WV5W9 z+C_EHnA*0ZU%<@_aVm_mFIFj;%6DFP<5N3dPoBGbP2cCYUvqG0?b}xp?1Sng9ZF=+ zLxN<=FUCbW_WeJGoXruQO8qiJxKR2G3bYD^SAn~_0#DCdC7$lO68|804VO1ffY7`o za=pE9aYq(cQP*NT%|sed&Uk%J*&GI+Dw#`Vs>prmXPbb2}UUaz`We*XE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<0;& z^Ya6#vwlf`{Tz4zv#Yni=9Ip-o^*~x6d6CS1H~+`q<`nofD-BjPn?6muK?JoCVKvT zxe~ZWMR?LzCBAf=Yz1C{UpwzOSp)ovlBMrOJ>eeT#C9!%_b-D_0;h7l|Pz)-q3He|%{U+Jt7%Z-Y@^zg_~!c4>?4K?+(#g*u4NYaR9GO;lukuo!5qCXQG zP8jjr@bDN+9Gn47)1^umNKhriXzPmZZZ%qOZ82~k#H|+>M$7HDMt8UGbW7wF6hOGc zW3=kZgWl35j9ndjnxh@Yp0>8Vt=&d@ue@QB;qkM1{3#{n5HJa z>r$s~$1Ear`(?@97_XST+Sgv7>%IeH#ItE*FqVqb{h0PW(26HhMlPE`^A~GQ0R-Qh z%_=wY299CidJPAU?%foK+NMcZpy1_WSF=zX*ho5c1c@z~J zPQsaOj_8UAhW;>ybFp{nLtyj^iB}eLubp^(#+29lN-T9bPxN{`&O1Q7j$^8kk|XiD znxT4Roc8M(6hPK87im&-)l}{bR7F zJq+9PI+N)vWR$3m6lb>Q{YDZPHJR;sJ<62#Nl=lAd^pn=!O$Lr?RnkGlz&dS{;bFJ zKG@TqhIwA!GObaCdF#)0m_~+T%J#etW;&}BxqNT?A5-?tN{`peOu2lrrP0j{EU@z^I9A&-cExyGhk z4!dAG=2yd*FfO0hgB8l&t50P)(^^%&QZI + +/* +The prime factors of 13195 are 5, 7, 13 and 29. + +What is the largest prime factor of the number 600851475143 ? + +https://projecteuler.net/problem=3 +*/ +int main(int argc,char**argv) { + + long primes[10000]; + int primeCount=1; + long primeVal=3; + long highestPrime=1; + primes[0]=2; + long startingNumb=600851475143; + label: + while (startingNumb>1) { + //find the next prime. + char isPrime=1; + for (int i=0;i zm#CYR7TBNgPlRwSL@*4=#XliZK@k)|u!`WSm1gR6W;UNSF!!7J&UentIWu#8&DhtB zy901wr5f>8sg^@=g4TxpQ=5{96LE-9^iNk%mW0oSn6nFSXH98O%DlBF&fM>MbLg;A zrd(6)2-3b#Aw=9k2UT)s@T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644 --- a/src/main.c +++ b/src/main.c @@ -1,30 +1,55 @@ #include /* -Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: +The prime factors of 13195 are 5, 7, 13 and 29. -1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... +What is the largest prime factor of the number 600851475143 ? -By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. - -https://projecteuler.net/problem=2 +https://projecteuler.net/problem=3 */ int main(int argc,char**argv) { - int fibStorage[1000]; - int val=0; - int counter=0; - int sum=0; - while (val<4000000) { - if (counter>2) { - val=fibStorage[counter++]=fibStorage[counter-2]+fibStorage[counter-1]; - } else { - val=fibStorage[counter++]=counter; + + long primes[10000]; + int primeCount=1; + long primeVal=3; + long highestPrime=1; + primes[0]=2; + long startingNumb=600851475143; + label: + while (startingNumb>1) { + //find the next prime. + char isPrime=1; + for (int i=0;i