ajhanaemohammed-blog
ajhanaemohammed-blog
Untitled
4 posts
Don't wanna be here? Send us removal request.
ajhanaemohammed-blog · 7 years ago
Video
Check her out, real talk. Love you mom
1 note · View note
ajhanaemohammed-blog · 8 years ago
Photo
I saw this and I wondered why isn’t this are logo it’s so dope.
Tumblr media Tumblr media
A Tech Girl
((One is transparent, and will be up on my Redbubble shortly!)) ((Please consider supporting me!))
25 notes · View notes
ajhanaemohammed-blog · 8 years ago
Text
Did you know? CS
Did you know there is a much faster way to compute greatest common divisor?
Let’s say we have a program and we want to know the gcd of two integers. We could go about finding this by a for loop, going from 1 to the smallest number (assuming the second integer is the smaller number) and seeing if each number divides into both numbers. We then return the largest number that divided into both. The code for this may look something like this:
Tumblr media
But what if our numbers are fairly large? That for loop would go from 2 to some huge number, and that would be rather slow. What if there was a faster way to do it? Well, that’s where number theory comes into play.
Let me just get the hypothetical stuff out of the way real quick. Let’s create two integers, a and b, and write them as such: a = bq + r. So if we can write a as a product of b (the smaller number) and q (the quotient) plus r (the remainder), this makes things much easier for us. We know what a and b are, so how do we figure out q and r? We can get q by using integer division on a / b (so we ignore any fractional part), then get r = a - bq or r = a % b.
So what does any of that mean? Let’s look at an example:
Tumblr media
When we get to 0, we know the last b (13 in this case) is the greatest common divisor. That makes any set of horrifying numbers not as threatening. It’s also fairly simple to implement in code:
Tumblr media
And to show you it’s significantly faster, let’s compare the two functions and benchmarked the results using C#’s Stopwatch.
Tumblr media
Pretty cool, right? Some people have taken this algorithm and extended it to push it to its limits and make it even faster! Of course, this starts getting more complicated and involves even more math. But this algorithm is absolutely fine for our purposes. 
I hope you’ve enjoyed this! I want this blog to be more than just Apptober stuff, so expect more stuff like this in the future!
620 notes · View notes
ajhanaemohammed-blog · 8 years ago
Text
Girls who code
I just realized that no matter how many times per day I ask my mom to take me to girls who code so that i can sign up, she isn’t going to touch the car until she is good and ready. WWWHHHYYY! The life of a 12 year old codeaholic 
0 notes