Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #2 Help Me ! » Probability problem » 2015-10-25 23:27:24

Tangram
Replies: 4

What is the probability that a random sample of 4 from the set {A, B, C, D, E} will contain at least two A's? (obviously, repetition of elements is permitted).

I tried to solve this using the on-site combinations calculator but I'm getting an error. My method is to work out the number of outcomes giving at least two A's and divide by the total outcomes.

The total outcomes is the number of ways without any restrictions, which is C(n-1+r, r) where n = 5 and r = 4, so this gives C(8,4) = 70. No problem with the site calculator on this step.

The tricky bit is finding the number of outcomes giving at least two A's. If at least two A's are to be present then each sample of 4 will have the form AAXY, where XY is a sample of size 2 (repetition allowed) from {A, B, C, D, E}. So using the same formula, n = 5 and r = 2, and C(6, 2) = 15. So the probability is 15/70. I think this is correct but I wanted to check using the calculator with the "has" rule. This is what I put in the box:

a,b,c,d,e
has 2 a

But I'm getting the error message "Warning: rule 'has 2 a' NOT understood".

Any suggestions? Thanks.

## #3 Re: Maths Is Fun - Suggestions and Comments » Asciimath » 2015-08-09 23:06:49

Hi bobbym,

Yes, codecogs is good, but I was thinking of asciimath as a possible forum feature to make it easier for members to enter math expressions ( rather than Latex ). But I suppose if Latex or mathml is already in place there wouldn't be much point.

## #4 Re: Help Me ! » Logic Problem - wrong? » 2015-08-09 23:01:30

Bob,

Yes, that's how the author of the book where I got the problem interpreted the statement - as an equivalence. But in that case it seems to me it should have  been worded  as "if and only if", and not just "only if". But maybe I'm nit-picking... ;-)

## #5 Maths Is Fun - Suggestions and Comments » Asciimath » 2015-08-09 20:26:57

Tangram
Replies: 3

Not sure what the forum uses for rendering math expressions, but I've just discovered Asciimath. There's a short tutorial where you can try it out here:

http://www.wjagray.co.uk/maths/ASCIIMathTutorial.html

Although not as comprehensive as Latex, it's VERY easy to use. No need to remember any complex syntax, just enclose the math between backticks () and use the simple and intuitive syntax. E.g.

The solution to

ax^2+bx+c=0

is

x = (-b+-sqrt(b^2-4ac))/(2a)`

asciimath is supported by Mathjax (https://www.mathjax.org/). Just add the following in the HEAD section of the html file:

<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full"></script>

That's it!

## #6 Re: Help Me ! » Logic Problem - wrong? » 2015-08-09 19:38:46

Hi Bob,

Thanks for that. It seems to depend on how you interpret "Dave says he will go only if Carol does and Bill does not". Specifically, "if" is not the same as "only if".

I interpreted the statement to mean "D => C.¬B". If you read it as meaning "C.¬B => D" then the argument does indeed come out as valid, but not when using
"D => C.¬B".

I checked the argument both ways using an online truth table generator:

http://turner.faculty.swau.edu/mathemat … ary/truth/

Copy and pasted the following one at a time:

(~e & ~b & ((a + d) > e) & (c & ~b > d)) > (~a & ~b & ~c & ~d & ~e)  This comes out as valid (all values TRUE)
(~e & ~b & ((a + d) > e) & (d > (c & ~b))) > (~a & ~b & ~c & ~d & ~e) This gives one FALSE value in the last-but- one row.

## #7 Help Me ! » Logic Problem - wrong? » 2015-08-08 23:25:27

Tangram
Replies: 5

Alice, Bill, and Carol are considering going to a party. Dave says he will go only if Carol does and Bill does not. Ed says he will go if either Dave or Alice or both go. You learn that Ed and Bill did not go. Who did go?

According to the source that this problem came from, the answer is that no-one went. But according to my reckoning, this is wrong.

Let A = "Alice goes", B = "Bill goes", etc.

I translated the premises as follows-

1. If D, then C and not-B.
2. if A or D, then E.
3. not-E
4. not-B

From these I generated the following-

5. not-(A or D) from 2 and 3.
6. not-A and not-D from 5.

I don't think anything else can be concluded, but it's not the case that no-one went, because whether C (Carol) went is indeterminate.

Any help appreciated!

## #8 Re: Coder's Corner » Is Anyone using BASIC Anymore? » 2014-07-26 20:40:11

I know this is an old thread, but just wanted to say I'm a fan of BASIC. There's a lot of snobbishness regarding programming languages, and it seems that BASIC is looked down on because it's too simple, doesn't have OOP or the latest bells and whistles. But really, any language that's Turing complete is functionally equivalent to any other. Why use arcane syntax and specialized structures, unless you're required to because of your job? (unless you just like learning programming languages for fun). Besides, in my opinion OOP is overrated, it's been shown to be a "bug attractor" and leads to bloated code. Programming is challenging enough without having to deal with all that cr*p.

Anyway, if you use Linux or Mac, I suggest BaCon, a Basic-to-C convertor which is easy to learn and uses much of the good 'ol classic BASIC syntax. Plus, it's fast because programs are compiled to C, and it's trivial to use any of the thousands of C libraries available.

http://www.basic-converter.org/

## #9 Re: Help Me ! » Combinations problem » 2014-07-26 20:16:36

You beat me to it. I can program in BASIC, and wrote this which also finds the numbers for longer sequences, assuming only the numbers 1-4 are used:

OPTION BASE 1
DECLARE counts[4]
c = 0
OPEN "permutations.txt" FOR READING AS perms

WHILE NOT(ENDFILE(perms)) DO
READLN line$FROM perms FOR i = 1 TO 4 IF COUNT(line$, ASC(STR\$(i))) THEN
INCR c
END IF
NEXT i
INCR counts[c]
c = 0
WEND

CLOSE FILE perms

FOR n = 1 TO 4
PRINT counts[n]
NEXT i

REM 4 x 1
REM 84 x 2
REM 144 x 3
REM 24 x 4

The permutations file was generated using the mathisfun permutations/combinations generator, which is a handy tool.

## #10 Re: Help Me ! » Combinations problem » 2014-07-26 19:39:54

And that's a good thing because it provides a check on whether your solution is correct. ;-)

## #11 Re: Help Me ! » Combinations problem » 2014-07-26 07:37:02

I found another way of solving this which seems a little simpler. The sequence can be thought of as two parts: the part with 2 different numbers and the remaining part with 2 numbers the same - x,y,(z,z). For the first part, there are 4C2  = 6 ways of choosing the two numbers from 4, and 2C1 = 2 ways of picking the last number from the remaining two, giving 6 x 2 = 12 combinations. There are 4 slots _ _ _ _, and for each combination, there are 4 ways to place the first number, and 3 ways to place the second, which automatically leaves two positions for the two z's, so there are 12 permutations for each combination, giving the required 144 ways.

## #12 Re: Help Me ! » Combinations problem » 2014-07-25 04:06:14

Hi bobbym,

Thanks! It always seems simple when someone else explains it, although that was a bit more involved than I thought.
By the way, that's quite a post count you have there!

Thanks again.