computer-science

random a 512-bit integer N that is not a multiple of 2, 3, or 5

╄→尐↘猪︶ㄣ 提交于 2019-12-01 21:08:10
if you are to choose a random a 512-bit integer N that is not a multiple of 2, 3, or 5 What is the probability that N is prime? i don't know the algorithm behind this one... i'm trying to work on a project but this is the starting point.. :) The number of primes less than n=2 512 is approximately n/log(n). The number of numbers you are considering is 4/15*n, so the probability you are looking for is 15/(4*log(n)), which is about 1 %. Probability bounds You may use the following inequality for the prime pi function : (Where log is taken in base e ) So: 8.58774*10 151 < π(2 512 ) < 8.93096*10

How does addition work in Computers?

眉间皱痕 提交于 2019-12-01 18:14:52
I was watching a video on computer architecture and a question came to my mind. How does addition and basic operations work on computers? I mean, i know that 2+2 = 4 but i don't know why? i just know that if i add 2 apples to another 2 then i see 4, but is there a possible demonstration of this? My question being is, how does a computer know that 2 + 2 = 4 at the most basic level? i know there are functions that add numbers, but at a basic level how is that addition performed? I just want to know this to understand better how computers work as the most basic and used operation performed by a

How is parallelism on a single thread/core possible?

[亡魂溺海] 提交于 2019-12-01 16:25:16
Modern programming languages provide parallelism and concurrency mechanisms as first class citizens to their users. I understand how parallel algorithms are programmed and can well imagine how two threads on a multi-core CPU can run in parallel. Yet, most of these platforms also support running parallel processes on a single thread. Do these processes really run in parallel? How, on an assembly level can two different routines be executed simultaneously on a single thread? TLTR; : parallelism (in the sense of true simultanenous execution) on a single, non-hyperthreaded CPU core, is NOT

How is parallelism on a single thread/core possible?

送分小仙女□ 提交于 2019-12-01 15:56:04
问题 Modern programming languages provide parallelism and concurrency mechanisms as first class citizens to their users. I understand how parallel algorithms are programmed and can well imagine how two threads on a multi-core CPU can run in parallel. Yet, most of these platforms also support running parallel processes on a single thread. Do these processes really run in parallel? How, on an assembly level can two different routines be executed simultaneously on a single thread? 回答1: TLTR; :

Why do Computers use Hex Number System at assembly language?

冷暖自知 提交于 2019-12-01 14:48:07
Why do computer use Hex Number System at assembly language? Why don't they use any other number system like binary, octal, decimal? What thing forced computer designer to use hex system at assembly? Why it looked so beneficial to them? Well it doesn't make a difference how you represent them but as we know that humans don't understand binary numbers, they are only to make the computer's life easier as it works on only two states true and false. So in order to make binary numbers(instructions) human readable we adapted the hexadecimal number system for representing assembly instructions. It has

How can one simulate nondeterministic finite transducers?

时间秒杀一切 提交于 2019-12-01 06:28:44
A nondeterministic automaton can be simulated easily on an input string by just keeping track of the states the automaton is in, and how far in the input string it has gotten. But how can a nondeterministic transducer (a transducer, of course, can translate input symbols to output symbols, and give as output a string, not just a boolean value) be simulated? It seems that this is more complicated, since we need to keep track, somehow, of the output strings, which can be numerous because of the nondeterminism. First of all, some theory. The following are distinct algebraic structures: generators

How can one simulate nondeterministic finite transducers?

戏子无情 提交于 2019-12-01 04:56:40
问题 A nondeterministic automaton can be simulated easily on an input string by just keeping track of the states the automaton is in, and how far in the input string it has gotten. But how can a nondeterministic transducer (a transducer, of course, can translate input symbols to output symbols, and give as output a string, not just a boolean value) be simulated? It seems that this is more complicated, since we need to keep track, somehow, of the output strings, which can be numerous because of the

max float represented in IEEE 754

妖精的绣舞 提交于 2019-12-01 04:25:36
I am wondering if the max float represented in IEEE 754 is: (1.11111111111111111111111)_b*2^[(11111111)_b-127] Here _b means binary representation. But that value is 3.403201383*10^38 , which is different from 3.402823669*10^38 , which is (1.0)_b*2^[(11111111)_b-127] and given by for example c++ <limits> . Isn't (1.11111111111111111111111)_b*2^[(11111111)_b-127] representable and larger in the framework? Does anybody know why? Thank you. The exponent 11111111 b is reserved for infinities and NaNs, so your number cannot be represented. The greatest value that can be represented in single

Can someone explain how Big-Oh works with Summations?

假装没事ソ 提交于 2019-12-01 03:42:40
I know this isn't strictly a programming question, but it is a computer science question so I'm hoping someone can help me. I've been working on my Algorithms homework and figuring out the Big-Oh, Big-Omega, Theta, etc, of several algorithms. I'm proving them by finding their C and N 0 values and all is going well. However, I've come across my last two problems in the set and I'm struggling figuring out how to do them (and google isn't helping much). I haven't had to figure out the Big-Oh/Omega of summations before. My last two problems are: Show that Σ (i=1 to n) of i 2 is O(N 3 ) and Show

How can I fold .cs files inside .xaml files in Visual Studio 2010?

非 Y 不嫁゛ 提交于 2019-12-01 02:51:21
How can I put my ViewModel file (a .cs file) folded inside its corresponded View file (a .xaml file) file like in the image? I don't know of a way to do it in visual studio, but you can edit your .csproj file in a text editor. You should find something like this: <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> <Compile Include="MainWindow.xaml.cs"> <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> The two tags might not be right next to each other in your file. The important part is the <DependantUpon>