Reputation
6,073
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
6 22 44
Impact
~283k people reached

Apr
28
comment Calculating the highest possible damage achievable using 6 items from a pool of ~25
@Shawn: Yuval used the standard method to count combinations with repetitions. See en.wikipedia.org/wiki/…
Apr
26
revised Calculating the highest possible damage achievable using 6 items from a pool of ~25
added 130 characters in body
Apr
26
comment Calculating the highest possible damage achievable using 6 items from a pool of ~25
@Shawn: Just test the cost in the inner loop and include the item-set only if the cost is under the budget. By the way, the folks around here are very helpful and friendly, but to be honest I think your question would find a better home on stackoverflow or programmers.SE. Cheers!
Apr
26
revised Calculating the highest possible damage achievable using 6 items from a pool of ~25
Allow duplicate combos in the code example
Apr
26
comment Calculating the highest possible damage achievable using 6 items from a pool of ~25
@Shawn: if you want to allow a,a,a,a,a,a then start each for loop at the value before it (rather than the value + 1). I edited my code above to do this. It increases the number of total loops to 593,775 from 177,100.
Apr
26
comment Calculating the highest possible damage achievable using 6 items from a pool of ~25
I was assuming that you have a set of helm, shoulder, bracer, glove, chest, and leg items and that you couldn't equip a given item other than in its proper slot. If you want to avoid repetitions, use the code above which will give you the 177,100 unique sets of 6 items taken from 25.
Apr
26
revised Calculating the highest possible damage achievable using 6 items from a pool of ~25
add some code
Apr
26
answered Calculating the highest possible damage achievable using 6 items from a pool of ~25
Apr
26
comment Computing the integral of $e^{-x^2}$ over the entire line
@Arturo & Ross: both links give the same proof... which is indeed quite slick. Cheers. (I would delete my question now, but it already has an answer, so this is disallowed.)
Apr
26
asked Computing the integral of $e^{-x^2}$ over the entire line
Apr
24
comment Run of $N$ successes before run of $k$ failures
Google found a math.SE question that was 45mins old when you searched? Wow.
Apr
21
comment How to rotate n individuals at a dinner party so that every guest meets every other guests
You might want to check out en.wikipedia.org/wiki/Combinatorial_design
Apr
21
awarded  Quorum
Apr
20
comment Calculate which day of the week a date falls in using modular arithmetic
I actually teach this algorithm in my algorithms class; it's useful in real life to be able to do this!
Apr
16
awarded  Good Question
Apr
16
comment Deleting any digit yields a prime… is there a name for this?
@Martijn I intended that the original number be prime as well; edited to clarify this.
Apr
16
revised Deleting any digit yields a prime… is there a name for this?
clarified that original number must also be prime
Apr
15
answered Deleting any digit yields a prime… is there a name for this?
Apr
15
comment Deleting any digit yields a prime… is there a name for this?
By the way, these number don't look random at all: they are heavily biased toward integers with repeated consecutive digits. Take 711110111, for example: such numbers appear often in our list because if deleting one 1 in a group yields a prime, then obviously deleting any other 1 in that group does as well.
Apr
15
comment Deleting any digit yields a prime… is there a name for this?
Here is heuristic evidence that there are infinitely many of these numbers: let $c(n)$ be the number of integers in $P$ with $n$ decimal digits. A quick computer program shows $c(2)=4$, $c(3)=11$, $c(4)=14$, $c(5)=16$, $c(6)=18$, $c(7)=13$, $c(8)=14$, $c(9)=18$; therefore $P$ is infinite. I'm joking, of course, but I would find it remarkable if such a list ended, in spite of your nice argument above.