No.163234
anon, jak to? nie potrafisz tego rozwiącać?
https://projecteuler.net/problem=66
____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163237
>>163234
>nazywanie szlaczków i cyferków problemem
Niech to poukłąda ten co to rozjebał.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163284
kurde jakieś duże te numerki
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163285
>iksy dupiksy na co to komu
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163302
skurwysyny. Macie tutaj funkcje, kurwa, ef od iks w tym punkcie, kurwa, a tu w tym punkcie macie kurwa skurwysyny, polskie śmiecie jebane, ef iks dodać kurwa delta iks, nie? Dla kurwa Eweliny i jej chłopaka, chuja jebanego, polskich zwierząt
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163304
Polibudziarz hiere zdana analiza matematyczna, algebra liniowa, kurwa całki, zespolone, geo analityczna, rachunek różniczkowi i tak chuja wiem xD
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163313
Największe to takie wyliczyłem, ale na pewno do D=1000 to są jeszcze większe:
16266196520² - 199*1153080099² = 1
Niech się tam trochę klocek pogrzeje, może nie będę musiał optymalizować algorytmu ;3
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163323
>>163313
Uważaj na dokładność po przecinku Anon
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163324
>>163323
Nie lecę na floatach, ale w sumie założyłem, że y>0, a to może być błędne założenie.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163326
>>163324
W sumie nie jest błędne dla x>1. Niepotrzebnie zatrzymałem liczenie ehhh.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163330
Odpaliłem na lepszym sprzęcie i liczy, ale najlepszy wynik do tej pory:
695359189925² - 856*23766887823² = 1
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163331
Moje rozwiązanie:
[spoiler]
import math
import decimal
decimal.getcontext().prec = 75
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def lcm(a, b):
return abs(a * b) // gcd(a, b)
class Fraction():
def __init__(self, numerator, denominator):
self.numerator = numerator
self.denominator = denominator
def __add__(self, fraction):
result = Fraction(0, 0)
if self.denominator != fraction.denominator:
result.denominator = lcm(self.denominator, fraction.denominator)
numerator = (self.numerator *
(result.denominator // self.denominator))
other_numerator = fraction.numerator * \
(result.denominator // fraction.denominator)
result.numerator = numerator + other_numerator
else:
result.numerator = self.numerator + fraction.numerator
result.denominator = self.denominator
return result
def reverse(self):
return Fraction(self.denominator, self.numerator)
def __repr__(self):
return '{}/{}'.format(self.numerator, self.denominator)
def are_solutions(x, y, d):
return x**2 - d * y**2 == 1
def calculate_fraction_convergent(period):
first_value = Fraction(period[0], 1)
fraction = Fraction(1, period[1])
for i in range(2, len(period)):
fraction = (Fraction(period[i], 1) + fraction).reverse()
return first_value + fraction
def main():
serach_range = filter(lambda x: not(
math.sqrt(x).is_integer()), range(2, 1001))
max_x = -1
answer = 0
for d in serach_range:
x = 0
y = 0
starting_value = decimal.Decimal(d).sqrt()
period = [math.floor(starting_value)]
n = 1 / (starting_value - math.floor(starting_value))
while not are_solutions(x, y, d):
a = math.floor(n)
period.append(a)
n = 1 / (n - math.floor(n))
solutions = calculate_fraction_convergent(period)
x = solutions.numerator
y = solutions.denominator
print("x={}, y={}, d={}".format(x, y, d))
if x > max_x:
max_x = x
answer = d
print(answer)
if __name__ == '__main__':
main()
[/spoiler]
Liczy do d=1000. zmieniajac precyzje, mozna policzyc wyzej.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163333
Moje takie, ale czy doliczy do końca, to nie wiem xD
#include <unistd.h>
#include <stdlib.h>
#include <gmp.h>
int main(int argc, char **argv) {
unsigned int d;
mpz_t d_, max;
mpz_init(d_);
mpz_init_set_ui(max, 0);
int begin = 2, inc = 1, fin = 1000;
if (argc > 1) begin = atoi(argv[1]);
if (argc > 2) inc = atoi(argv[2]);
if (argc > 3) fin = atoi(argv[3]);
unsigned long inc_y = 1;
unsigned long count_y = 16777216; // 2**24
unsigned long iter_y = 0;
int done_x[1001] = {0};
while (1) {
unsigned long init_y = inc_y + iter_y * count_y;
int tested = 0;
for (d = begin; d < fin; d+=inc) {
if (done_x[d]) continue;
mpz_set_ui(d_, d);
if (mpz_perfect_square_p(d_)) { done_x[d] = 1; continue; };
tested += 1;
mpz_t x, dysq, xsq;
mpz_inits(x, dysq, xsq, NULL);
unsigned long y = init_y, iter = 0;
while (1) {
mpz_mul_ui(dysq, d_, y);
mpz_mul_ui(dysq, dysq, y);
mpz_add_ui(xsq, dysq, 1);
if (mpz_perfect_square_p(xsq)) break;
if (iter > count_y) goto skip;
y += 1;
iter += 1;
}
mpz_sqrt(x, xsq);
done_x[d] = 2;
if (mpz_cmp (max, x) < 0) {
mpz_set(max, x);
gmp_printf("New best: %Zd² - %d*%ld² = 1\n", x, d, y);
}
skip: {}
}
gmp_printf("Finished iteration %d : tested %d numbers : remaining: ", iter_y, tested);
for (d = begin; d < fin; d+=inc) {
if (!done_x[d]) gmp_printf("%d,", d);
}
gmp_printf("\n");
if (tested == 0) break;
iter_y += 1;
}
}
gcc -O3 -Wall 66.c -o 66
Odpalam: ./66 (2+numer wątka liczone od 0) (ilość wątków)
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163335
>>163333
To znaczy, oczywiście:
gcc -O3 -Wall -lgmp 66.c -o 66
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163369
>>163331
ja pierdole kurwa….
niech mnie chuj
Kurwa…. powiedz. ty jesteś szcześliwy w życiu?
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163372
>>163369
? To nie jest nic trudnego, wystarczyło dojść do tego, że to jest równanie Pella, a potem zaimplementować rozwiązywarkę
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163392
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163404
>>163372
imponujące ale… Nie staram sie ciebie obrazić ani nic ale powiedz mi: Czy to ma jakieś praktyczne zastosowanie w życiu? To jest abstrakcja to jest oderwane od rzeczywistosci
Inb4 Matematyka bada matryce rzeczywistosci
wielkie i zdecydowane. Prawdziwa nieskończoność nie jest matematyczna. Tak samo jak teoria M nie jest absolutna tak długo jak sie ją rozpatruje tylko naukami ścisłymi.
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163424
>>163404
wróć do 4chan i umieść tam kucyki, dziwny skurwielu
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163427
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163450
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163469
>>163450
esteś upośledzony i byłeś tak bezużyteczny jako dziecko, że nikt się nie przejmował, kiedy byłeś molestowany seksualnie
XD
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163497
>>163469
TO ja ci kurwa ładne kucyki postuje… a ty tak?
A ty Kurwa tak?
PTFU TY KURWO TY XD
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.
No.163510
>>163497
byłeś wykorzystywany seksualnie jako dziecko
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.