text stringlengths 1 330k |
|---|
[Validate:NotNullOrEmptyString(boo), NotNull(hoo)] |
public int Foo(string boo, FooBoo hoo) { |
Page 1 of 3 (35 items) 123 |
Skip to main content |
What marketable skills do ICS majors gain? |
ICS graduates are educated and equipped to work in an increasingly multicultural world. They will recognize differing worldview assumptions and contrasting cultures. They will more effectively handle cultural clashes in their given work setting. If they work and live overseas, they are more likely to succeed, to survive culture shock, or at least recover from it. They can identify cultural misunderstandings, ethical value clashes, and more effectively solve related problems. These are marketable skills. |
Report Abuse |
Report this review to the Review Centre Team |
Why are you reporting this review? |
“Goods despatched timely as specified” |
Written on: 28/04/2013 by Tharani (1 review written) |
The delivery company arrived within the 1 hour timeslot as specified by Uttings on their delivery email. |
However I'd like to make 2 suggestions to Uttings: |
1. The delivery information on the website should give more information, such as receipt of delivery information by email, 1 hour timeslot for delivery,...This is not obvious for first time Uttings customer such as myself. |
2. The male person at customer service should be more forthcoming with information and not reply with one word answer to my question about delivery. I'd not have phoned Uttings had I known your delivery procedure like I do now. |
Despite all this I would quite happily recommend a friend to Uttings. |
Qualifier Amit Bhushan makes it to the round of 32 |
Alok Kumar maintained his hundred per cent record in the group stage but not before surviving a scare from Mumtaz Ali in the men's snooker event of the Hash10 World Sim Nationals here on Saturday. It was also a good day for qualifier Amit Bhushan, who upset Rupesh Shah in his last group stage encounter, to make it to the round of 32. |
Alok Kumar, who had already qualified for the knockout stage, could not get off to a good start. His best break of the frame was a paltry eight as Mumtaz Ali's breaks of 24 and 20 gave him the lead 64-31. |
There was a change of tactics by Alok Kumar, as the veteran gave up on his chances to build a break to play the waiting game instead. Each of his pots was followed by touching the cue ball behind a colour, forcing Mumtaz Ali to either go for a high risk pot at the other end of the table or concede the foul. Alok Kumar's defensive play gave him the frame 53-8. |
Cautious ways |
Alok Kumar continued with his cautious ways, but Mumtaz Ali reaped the rewards for attempting to break out, as he ran up a 48-20 lead. With just the colours on the table (green and upwards) the cueists attempted to break the position down for a good 20 minutes before Mumtaz Ali claimed the frame 59-27. |
Mumtaz Ali could have won the next frame and with it the match, but failed to make his lead count as Alok Kumar cleared the table to take the contest to a decider, which he won comfortably. |
Amit Bhushan, in only his second year at the senior level, pulled off the biggest win of his career when he came back from being 40 points down at 1-2, to win his group match 3-2 (65-51, 59-67, 60-41, 82-70, 61-40) against Rupesh Shah. |
Qualifiers Jassim Tawin and Rajkumar, also of Karnataka, joined Bhushan in the round of 32. |
Yasin Merchant, Manu Dev, Manan Chandra and Brijesh Damani expectedly navigated past the group stages as well. |
Good start |
Aditya Mehta, one of India's few professional snooker players, got his campaign off to a winning start, getting the better of Manish Jain 81-6, 41-74, 89-0, 62-58 in a testing encounter. |
The results (group stage, best-of-five frames): Group A: Nikhil Ootam (Mah) bt Ranbir Singh (Raj) 64-18, 50-22, 58-8. Group B: Vijay Nichani (TN) bt Rajat Khenja (Chn) 78-38, 25-7, 80-13, 68-34. Group C: Sumit Talwar (Chn) bt Simrankeet Singh (Raj) 68-49, 71-39, 43-56, 73-14. Group D: Gurvinder Gulati (Pun) bt Vikas Sharma (UP) 64-41, 60-45, 28-55, 47-83, 72-28. Group E: Amarnath Sharma (Meg) bt Sumesh Turki (J&K) 50-44, 31-58, 59-25, 61-49; Aditya Mehta (Mah) bt Manish Jain (WB) 81-6, 41-74, 89-0, 62-58. Group G: Sarang Shroff (Mah) bt Nigel D'Souza (Goa) 75-29, 45-12, 58-20; Alok Kumar (PSPB) bt Mumtaz Ali (Jha) 31-64, 53-8, 27-59, 49-41, 71-13. Group H: Siddarth Rao (TN) bt Lallawmkima (Miz) 38-42, 88-14, 78-2, 72-8. Group I: Malkeet Singh (UP) bt R. Loganathan (TN) 91-20, 85-57, 63-20. Group J: K. Venkatesam (Rly) bt Jeet Kishore (Ori) 73-31, 13-65, 55-9, 46-73, 63-42. Group K: Sandeep Gulati (Del) bt Jay Shankar (Jha) 50-26, 72-13, 78-13. Group L: Jasim Tawin (Kar) bt Lalrina Renthlei (Miz) 28-66, 72-30, 66-4, 56-13. Group M: Divya Sharma (Har) bt Shabaz Khan (PSPB) 65-42, 70-45, 50-83, 55-52; Faisal Khan (Rly) bt Subrat Das (WB) 12-46, 75-16, 68-2, 87-9. Group N: Nigel Lazer (TN) bt Nitin Agarwal (MP) 58-38, 56-41, 67-49. Group O: Amit Bhushan (Kar) bt Rupesh Shah (PSPB) 65-51, 59-67, 60-41, 82-70, 61-40. Group P: D. Rajkumar (Kar) bt Manish Morani (Meg) 73-13, 64-16, 63-10. |
Graphs now stored in cache |
Tags: storage, caching, update |
As mentioned earlier, for performance reasons Associativy loads the whole graph (persisted in the SQL DB) into memory upon the first request to access the specific graph (it's also possible to have purely in-memory graphs BTW!). Formerly this was done by storing the graph in an ISingletonDependency, meaning in an object that lived in an Orchard tenant for the whole life time of the shell. This worked, but wasn't particularly nice and absolutely not scalable. |
With the new implementation, the graph is stored in the Orchard cache. With the default cache implementation this does not change much. However, if you have an implementation of ICache using a distributed cache provider (e.g. an AppFabric implementation exists) under the hood, you can put multiple nodes under you Orchard site and Associativy will still work consistently. So now you can have even bigger graphs. Yay! |
Take the 2-minute tour × |
Is there are some references to algorithms that generate the set of prime numbers located between two given numbers n1 and n2? |
I would like to consider the cases when n1 is large while n2-n1 is small or while n2-n1 is large. |
If we consider these cases: |
[1] n1=$2^{10}$ & n2=$2^{11}$; |
[2] n1=$2^{40}$ & n2=$2^{45}$, (modified to [2a]); |
[3] n1=$2^{100}$ & n2=$2^{101}$, (modified to [3a]); |
[4] n1=$2^{1000}$ & n2=$2^{1001}$, (modified to [4a]); |
Is there is a well known algorithm to generate the set of all primes p ∈ [n1,n2] without generating all primes p < n1? |
By considering for example these cases: |
[2a] n1=$2^{40}$ & n2=$2^{40}+2^{20}$; |
[3a] n1=$2^{100}$ & n2=$2^{100}+2^{20}$; |
[4a] n1=$2^{1000}$ & n2=$2^{1000}+2^{20}$. |
share|improve this question |
How do $n_1$ and $n_2$ compare? I think the answers below are assuming that $n_1$ is significantly larger than $n_2-n_1$. – David Speyer Jul 25 '10 at 18:35 |
@David: Without this assumption he could just generate all primes less $n_1$ using Atkin's sieve (cr.yp.to/primegen.html) if $n_2$ is around $10^{15}$ or simply forget about it if $n_2$ is much bigger. – j.p. Jul 25 '10 at 20:48 |
What do you consider large and what small? E.g., is $n_1$ around 1000 bit long? And does the "large" for $n_1$ mean the same as the "large" for $n_2−n_1$? (I wouldn't try to find all primes in an interval of length $2^{1000}$, but finding primes of size $2^{1000}$ is no problem.) – Someone Jul 26 '10 at 8:44 |
Is there any reason why you don't want to generate the primes $<n_1$ for the cases [1] and [2]? Otherwise you can simply use the program from cr.yp.to/primegen.html . And in your cases [3] ($n_1=2^{100}$) and [4] ($n_2 = 2^{1000}$) with always $n_2 = 2*n_1$ the intervals are much too long. You'll get around $2^{100}/ln(2^{100}) =1.8..10^{28}$ rsp. $2^{1000}/ln(2^{1000})=1.5..10^{298}$ primes. – Someone Jul 26 '10 at 10:20 |
Do not use the Gries algorithm! It's actually slower than the Sieve of Eratosthenes. See Pritchard's "Improved incremental prime number sieves". – Charles Jul 26 '10 at 20:22 |
9 Answers 9 |
The fastest approach should be first to sieve the numbers by marking the numbers divisible by small primes (for this you should use only one long division per short prime), then to use a Fermat test to the base 2 (as it is more efficient since multiplication with 2 is a left shift) on all unmarked numbers. Finally apply a certain number of Miller-Rabin tests to all candidates passing the Fermat test to reduce your error probability to a level you can tolerate (e.g., $2^{-100}). |
share|improve this answer |
That gives you a prime; he is looking for all the primes – BlueRaja Jul 25 '10 at 18:29 |
Thanks BlueRaja,I corrected my answer accordingly. – j.p. Jul 25 '10 at 20:34 |
Don't use a Fermat test; use a Miller-Rabin test for the initial scan. It's just as fast and slightly better. If you want an error level as low as $2^{-100}$ you should use one of the Frobenius tests like Grantham's (but not for the initial test, of course!) – Charles Jul 27 '10 at 6:37 |
@Charles: A Fermat test with base $2$ takes approx. 25% less time than a MR-test, as one can replace the Square-and-Multiply algorithm for the exponentiation by a Square-8-Times-Then-Multiply algorithm if the numbers have more than 256 bit. Per bit of the exponent one needs therefore only 9/8 operations instead of 3/2 in average. – j.p. Jul 27 '10 at 10:34 |
@Charles, part II: To get an error level of $2^{-100}$ one should use the results of Damgard, Landrock, Pomerance (math.dartmouth.edu/~carlp/PDF/paper88.pdf) instead of the weaker bound $4^{-k}$ for $k$ tests (DLP show that 9 tests for bit length 512 and 2 tests for bit length 768 are sufficient). I do not know of a similar analysis of Grantham's Frobenius test, but would be interested in it. – j.p. Jul 27 '10 at 10:46 |
This was originally a comment on TonyK's answer, but it was too large to submit as a comment so I'm putting it here. I thought the numbers might have value to some. |
Let's say that it takes $b^{\lg 6}/10^{10}$ seconds to test a $b$-bit number with the M-R test and $b^{\lg 24}/10^{13}$ seconds to prove primality with ECPP. Testing a range up to $n_2=2^b$ with M-R + ECPP would take about $$\left(n_2-n_1\right)\left(\frac{b^{\lg 6}}{10^{10}}+\frac{b^{\lg 24}}{10^{13}\ln n_2}\right)=\left(n_2-n_1\right)\left(\frac{b^{\lg 6}}{10^{10}}+\frac{b^{\lg 12}}{10^{13}\ln2}\right)$$ seconds. For $n_2-n_1=2^{20}$ and $n_2$ large, this is about $1.5(\lg n_2)^{\lg12}/10^7$ seconds. |
On the other hand, suppose sieving $n_1$ to $n_2$ takes $\sqrt{n_2}/10^6+(n_2-n_1)/10^{8.5}$ seconds. For $n_2-n_1=2^{20}$ and $n_2$ large, this is about $\sqrt{n_2}$ seconds. |
Equating the two suggests that, for intervals about a million wide, testing each member is superior to sieving beyond about $n_2>8\cdot10^8$. Only about 12 kB of memory are needed to store all the primes up to the square root of that limit, so the fourth power trick doesn't seem viable here at all -- by the time you run out of primary memory you shouldn't be sieving at all. |
share|improve this answer |
@Charles: may be your example is correct and valid when the interval $[n_1,n_2]$ is small compared with $n_2$, but when the interval is relatively wide, (for example when $n_1=n_2/2$), the same demonstration can be used to prove the contrary. – Mohammed Marey Jul 27 '10 at 18:57 |
I used the width you used. For any fixed interval width it can be shown that beyond some fixed point, standard sieving (Eratosthenes/Atkin) is less efficient than testing each member in the range. (If you implement the algorithms yourself, it's obvious.) But of course I intend for the argument to go both ways: when the interval is wide compared to its height, sieving is better -- often vastly better. – Charles Jul 27 '10 at 19:36 |
@Charles: Yes, you are true, the efficiency of the used algorithm depends on the value of $n_1$ and $n_2$. – Mohammed Marey Jul 28 '10 at 21:16 |
If $n_1$ and $n_2$ are not too big you can use Eratosthenes sieve (see wikipedia for this). If they are big enought you can use sieve to cross out numbers which have small prime divisors and after that check every number that wasn't crossed out and check if it is prime using any primality test (see http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test). |
share|improve this answer |
Unless you have very specialized needs, you can probably apply standard sieving techniques. Here are a couple references. First, hot off the press is Kjell Wooding's Calgary thesis [1], which includes a good overview of both software and hardware sieving techniques (e.g. FPGA-based sieves, Calgary's scalable sieve, etc). Its bibliography should prove useful as an entry point into the literature. Also, here [2] is a charming classic paper by D.H. Lehmer - one of the pioneers of computational number theory. It gives a nice succinct introduction to sieving in general. Such methods have a long venerable history that stimulated much development in both number theory and computer science, e.g. google "Lehmer sieve" and you'll discover many ingenious machines devised to carry out number theoretical computations long before the dawn of the modern digital computer, e.g. via bicycles chains, photoelectric devices, etc. |
1 Wooding, Kjell. The Sieve Problem in One- and Two-Dimensions. |
PhD Thesis. Calgary, Alberta. April, 2010 |
share|improve this answer |
@Dubuque: Thank you Dubuque.. – Mohammed Marey Jul 28 '10 at 21:13 |
You can get away with storing $n_2^{1/4}$ bits for the sieving data. Generate the primes $<= n_2^{1/4}$, and use them to generate the primes in successive intervals of length $n_2^{1/4}$ dynamically, up to $n_2^{1/2}$. The primes thus generated can be used to generate the primes in the interval $[n_1,n_2]$. |
share|improve this answer |
@TonyK: Is there is a good reference that explains generating primes in successive intervals dynamically. – Mohammed Marey Jul 27 '10 at 11:59 |
@Mohammed: If you have all the primes up to k, and an interval [a,b] with k < a < b < k^2, then you can sieve the interval [a,b], right? That's all I meant. – TonyK Jul 29 '10 at 12:45 |
You can use prime sieves. |
share|improve this answer |
I'm assuming you're asking if we can generate primes in [n1, n2] without generating the primes before that (using a sieve), to which the answer is, no, nothing aside from testing every number between n1 and n2 for primality using something like Rabin-Miller. |
Note that this will be significantly slower than sieving unless the numbers are extremely large and the range [n1, n2] is comparatively small. |
share|improve this answer |
NB. From what I understand Miller-Rabin is still the preferred method for something like this in practice even though it's probabilistic; AKS is much much slower and Bernstein's probabilistic version of AKS is still slower than MR. – Steve Huntsman Jul 25 '10 at 19:04 |
Of course M-R doesn't prove primality, so in some cases it's inappropriate unless followed by a proof. For example, it would be a bad choice if you were enumerating the pseudoprimes like, e.g., Richard Pinch... chalcedon.demon.co.uk/rgep/carpsp.html – Charles Jul 25 '10 at 19:08 |
Yes, Rabin-Miller is used in practice in cryptography, usually 100 times to give a probability of failure of $1−1/2^{100}$ , which is close enough to certain for practical purposes. However, if this worries you too much, you can of course use something like AKS, which is deterministic. – BlueRaja Jul 25 '10 at 23:39 |
That is what i am asking about, to generate all primes in [n1,n2] without generating primes less than n1. – Mohammed Marey Jul 26 '10 at 8:23 |
Let $S=\sqrt{n_2}$. If S is bigger than your computer's memory in bits, then you're going to have trouble generating all the primes in that range; if you insist, break the range into pieces that fit into memory, mark off the ones with small divisors, and test the remaining numbers for primality. You want to do as much sieving as possible, so fill maybe half the memory with primes and use those for sieving. |
If S fits in memory and $n_2-n_1$ is not much smaller than S, use a sieve (sieve of Atkin or Eratosthenes). You may need to use a segmented version of the sieve, depending on how large $n_2-n_1$ is. |
If $n_2-n_1$ is significantly smaller than S, make a bit array of (segments of?) the range, mark off small divisors, and test the remaining members for primality. |
share|improve this answer |
This means we should test for primality of each number in [n1, n2] which is not nice if the length of [n1 ,n2] contains for examples $2^{10}$ or $2^{50}$ numbers !!. Or we should generate all primes p < n2 which is not nice if n1 is a large number for examples $2^{50}$!! – Mohammed Marey Jul 26 '10 at 10:16 |
@Mohammed: The distance between primes is ~ ln(n), so even if you are only looking for the primes between [$2^{50}$, $2^{51}$) ($2^{50}$ numbers), you are still looking at many terabytes of space to store all those primes. – BlueRaja Jul 26 '10 at 16:29 |
Practically speaking, if you want to generate all primes in a large interval, you need to be able to store the primes up to the square root of the upper end of the interval in main memory. To sieve [2^50, 2^51] would require storing the 2,857,269 primes up to sqrt(2^51) which is pretty easy (11 MB using 32-bit integers). With 8 GB of main memory you could sieve an interval with upper bound of 2^68. – Charles Jul 26 '10 at 17:00 |
@Charles: Is there is a clear reference explaining in details your practical comment? – Mohammed Marey Jul 27 '10 at 11:46 |
@Mo: You'll have to if you're using the Sieve of Eratosthenes or Atkin. But if you're looking at $[2^{1000},2^{1000}+2^{20}]$ then you won't want to store the ~244 TB of primes up to the square root. Instead you should sieve out the multiples of the first thousand primes (removing 94% of the range), M-R the remaining numbers (removing ~98% of the candidates), and prove the primality of the remainder -- or test them to sufficient confidence, as desired. – Charles Jul 27 '10 at 16:39 |
The other answers have covered the right strategies, but here are a few additional comments. |
On an idealized computer with an unbounded amount of memory, the cost of sieving $[n_1,n_2]$ for the prime $p$ is $C_1(n_2-n_1)/p$ for some constant $C_1$, the average cost of a memory read & write operation. Therefore, the cost of sieving $[n_1,n_2]$ for all primes up to some bound $B$ is $$C_1 (n_2 - n_1) \sum_{p\leq B} \frac{1}{p} = (n_2 - n_1) (C_1 \log \log B + O(1)),$$ by the 2nd Mertens Theorem. The numbers in $[n_1,n_2]$ that remain after sieving is approximately $$(n_2-n_1)\prod_{p \leq B} \left(1-\frac{1}{p}\right) = (n_2 - n_1) \frac{e^{-\gamma}}{\log B},$$ by the 3rd Mertens Theorem. Therefore, the time for testing the remaining numbers for primality is about $$C_2(n_2-n_1) \frac{e^{-\gamma}}{\log B},$$ where $C_2$ is the average cost of a single primality test. The optimal sieving bound $B$ is then approximately $\exp(e^{-\gamma} C_2/C_1)$. |
The "constants" $C_1$ and $C_2$ are best determined empirically. In reality, the constant $C_1$ depends heavily on the length of the interval $[n_1,n_2]$ while the constant $C_2$ depends mostly on the size of $n_2$. The constant $C_2$ should vary smoothly with $n_2$, but there will be sharp increases in $C_1$ when the cache size is exceeded and a still larger increase if disk swaps are necessary. Here is a trick that will help you fit longer intervals into the cache, especially if you have multiple processors available. The cost of sieving is higher for small primes, to save some of this time, break the interval into arithmetic progressions $a + Mx$, where $\gcd(a,M) = 1$ and $M = 2\cdot 3 \cdots p_i$ is the product of the first $i$ primes. Each such progression can be sieved independently, possibly on different processors. Essentially, we're breaking the interval into $\phi(M) = (2-1)(3-1)\cdots(p_i-1)$ different progressions which each require $(n_2-n_1)/M$ bits to store in memory while the total sieving and testing times remains about the same. I have some C code that implements this strategy with $M = 2\cdot 3 \cdots 29$ if you're interested. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.