Hadaward 'Solly'
Ok , I will try to get used to void then . Thank you all .
cant wait til you start using functional paradigm in C
Anonymous
Anyone here compiled nginx with different libc library like newlib? Pm me
Kl44
Does anyone have idea about race condition error ??
Almog
Hello what im looking to do is to scan two numbers, say k,t, and make a table (in C) : \_\_\_\_\_\_\_ k \_\_\_\_\_k+1\_\_\_\_\_k+2.....K+9 t t+1 t+2 . . . t+9 and in the middle of them to put the largest prime divisor between every two numbers (t and k, t+1 and k+1 and so on) i know how to find the largest divisor. how to find the largest prime divisor is my problem/
mov $22, %rax
I don't know any factoring algorithm, but you can find it on the internet. Though I don't think this is the best way to solve your problem, but it should work
mov $22, %rax
/get cbook
Almog
largest prime divisor - give definition of what is it
1,3,5,7,11.. primal number that can divide both of k and t
Anonymous
1,3,5,7,11.. primal number that can divide both of k and t
So it's like GCD but for prime numbers??
mov $22, %rax
largest prime divisor - give definition of what is it
he surely meant largest common prime divisor, don't know the use of it though
mov $22, %rax
So it's like GCD but for prime numbers??
Prime numbers can't have a common divisor... unless they're equal. Doesn't make sense
Anonymous
Prime numbers can't have a common divisor... unless they're equal. Doesn't make sense
I thought it like , for 10 and 15 , 5 is the greatest common divisor also a prime number something like that...
Anonymous
hehe
mov $22, %rax
I thought it like , for 10 and 15 , 5 is the greatest common divisor also a prime number something like that...
yep. But for 20 and 30 for example 10 is the GCD, but 5 is still what he is looking for
mov $22, %rax
5 is the prime GCD then..
exactly. He should factor 10 and select the largest prime which makes up the GCD... dunno how to do that though
Anonymous
Yeah
su
Do you know the algorithm for finding prime numbers?
What about prime GCD, can you formalize that?
mov $22, %rax
mov $22, %rax
What about prime GCD, can you formalize that?
It is the gratest prime factor of the GCD taken without exponent
su
Euclidean algorithm
may be the better to use Eratosphele sieve, at least?
su
I asks for formal math definition, is that so complex?
mov $22, %rax
may be the better to use Eratosphele sieve, at least?
Euclidean algorithm is one of the fastest, as far as I know
Anonymous
Euclidean algorithm
Find all prime numbers within the limit of your smallest number(e.g for 10 and 20 , prime 2,3,5,7 i.e less than or equal to 10) and then store it in a list , then using iterations check which prime prime number is the gcd , this is what I could think of..
su
if GCD == p1^i1*p2^i2 … pn^in, where Pk is P, and ik >= 0 is Z, what is prime GCD
su
if GCD is 2^5*3^12*5^8 what is prime GCD?
mov $22, %rax
I asks for formal math definition, is that so complex?
Let's assume a and b belong to N and d does too [1] If d |a and d | b [2] AND if d | d' where d' is every natural number which has the characteristics described in [1] If d is prime it is the Gratest Common Prime Divisor If it isn't than the GCPD is the gratest prime factor of d
mov $22, %rax
Half formal, half not 😅, it's the best I could do
mov $22, %rax
if GCD is 2^5*3^12*5^8 what is prime GCD?
it is the gratest prime factor, but you don't take exponents into account
Anonymous
Euclidean algorithm is one of the fastest, as far as I know
The sieve of Eratosthenes is one of the most efficient ways to find all primes smaller than n when n is smaller than 10 million
su
it is the gratest prime factor, but you don't take exponents into account
so ‘prime’ GCD for 2^5*3^4*5^2 and 2^2*3^3*5^4 is 2*3*5 or 2^2*3^3*5^2 (generally known as GCD(a,b)) ?
mov $22, %rax
the point is that 'prime' GCD is a prime number
mov $22, %rax
I talk about it as if it was really a thing 😂
mov $22, %rax
I don't think that mathematicians learn about it...
Yedi
👍
Anonymous
Just now saw this exact phrase in geeks4geeks site lol
Ask if purpose is served or not buddy! Keep calm and enjoy life
Hadaward 'Solly'
Just now saw this exact phrase in geeks4geeks site lol
Sieve of Eratosthenes is like Killer Queen. It has no weakness.
su
Euclidean algorithm is one of the fastest, as far as I know
there some more advance versions, for a task of GCD there need to be a special alg, cause as far as man asked for the help it will be used in a grid, co computationaly there must be some tweaks as well
su
Are you @kryptographer a crypto guru? Have some fun with this https://repl.it/@ArturMustafin/python-caesar-encoder#main.py
Anonymous
Hi, i am solving prblem whitch i have. I dont know how create line between two coordinates in C
Anonymous
Can someone help me?
su
Can someone help me?
painter algorithm or what?
Anonymous
painter algorithm or what?
For example, if I enter the coordinates [4,3] and [2,5], a line will be created between them in text mode
su
For example, if I enter the coordinates [4,3] and [2,5], a line will be created between them in text mode
do you need a function which returns array of coordinates intersects by the line built as two input coordinates?
Vitalii
double x, h, a = 1, b = 9; h = (b-a)/n; for(x=a; x<b; x+=h) { printf("x = %lf\t\ty = %lf\n", x, y); }
Vitalii
x = 1.000000 y = 0.000000 x = 2.333333 y = -2.568166 x = 3.666667 y = -5.084649 x = 5.000000 y = -7.937005 x = 6.333333 y = -11.065353 x = 7.666667 y = -14.429219 x = 9.000000 y = -18.000000
Vitalii
why when I'd entered amount of steps n = 6, it turned me 7 steps? When I enter 1 or 2 or 3 or some other values, it works right
Vitalii
Idk why, but exactly values: 6 and 7
Vitalii
I guess the problem is definitely inside the loop, but I can't understand what exactly...because generally other values work right except 6 and 7
su
3-4 cut 4-5
su
(5-3)/2 = 1 cut
su
but 3 points 3, 4, 5
mov $22, %rax
https://paste.ubuntu.com/p/8qcWttcnB9/ How do you judge the efficiency of this code?? The function loads the first n/log(n) primes Yes... it is pretty awful
Anonymous
thanks
Anonymous
okay
mov $22, %rax
how fast it calulates 1M of prime numbers?
1.000 or 1.000.000? Sorry for the ignorance
Vitalii
but 3 points 3, 4, 5
Sorry, what should I do?...
Anonymous
i m a software engeneering student 3 semister you gays help me okay
mov $22, %rax
I really don't know how to check... I try to run it in gdb
su
obviously, 1) resetting table and cleaning up is not the best solution 2) you can take i in form 6k+1 or 6k-1 , speed up i++ six times as fast
su
if you cant eval 1M of primes, it literally no purpose to talk about performance anyway
su
it is not 1M as upper bound, it IS first 1M of primes, so count prime numbers not upper N limit
su
should be 15485863