# Math Is Fun Forum

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

You are not logged in.

## #1 Computer Math » Project Euler Problem 82 » Yesterday 14:22:05

phrontister
Replies: 0

Problem #82 Path Sum: Three Ways:

I solved it in Excel, borrowing from the logic of my Excel solution for problem #81.

## #2 Computer Math » Project Euler Problem 81 » 2024-06-07 13:26:46

phrontister
Replies: 0

Problem #81 Path Sum: Two Ways:

I managed to solve this one in Excel. Had to google for a logic clue first, though, after failing with my attempts at M & BASIC code.

## #3 Computer Math » Project Euler Problems 18 & 67 » 2024-06-06 17:13:38

phrontister
Replies: 0

Problem #18 (Maximum Path Sum I):

Problem #67 Maximum Path Sum II):

bobbym's Down the rows and columns game thread from 2012 has 3 more of these. I solved them longhand back then coz they were easy enough. Also, I just hadn't considered using code.

I solved #18 longhand, but #67 was much too big for that! I tried and failed with M & BASIC code, but worked out a nice Excel (spreadsheet) solution for each of them (including bobbym's). Had to google for a logic clue first, though.

## #4 Re: Computer Math » More Project Euler problems » 2024-05-30 01:24:22

I've solved #48 in M...a bit too big for Excel!

Not too big for my freeware Just BASIC program, though.

That's how I first solved it in M, but later improved it to follow the more standard M way with their functions.

## #5 Re: Computer Math » More Project Euler problems » 2024-05-29 23:45:56

phrontister wrote:

PS...I found a solution in M, but need to work a bit on my code still.

I've tidied it up a fair bit, but I'm sure it can still be improved further (or changed altogether!).

## #6 Re: Computer Math » More Project Euler problems » 2024-05-29 15:08:20

Keep_Relentless wrote:

See how long #45 takes you, I considered that a win.

I looked for a method in M for half an hour or so, but formed no real idea on how to go about it.

So, I opened my trusty Excel, and found the answer in about 20 minutes.

I'll have to try M again, though...but not sure when.

From bobbym's signature: Always satisfy the Prime Directive of getting the right answer above all else.

PS...I found a solution in M, but need to work a bit on my code still.

## #7 Re: Computer Math » More Project Euler problems » 2024-05-29 13:52:53

Haven't tried #45 yet, but succeeded with #40 after several clumsy goes at it.

Solved it in M, starting with some awful code that I didn't like, improved it a bit (still didn't like it), and eventually got something I'm quite pleased with.

Yes...I agree with your last comment.

Always learning!

## #8 Re: Computer Math » More Project Euler problems » 2024-05-29 02:18:08

Hi K_R;

I've done 16, 20 & 25, but that'll do me for now (bed time).

I used M for all three, with #25 taking the longest. For that one, I initially found a solution with a For loop, but then a better one with M's Fibonacci function, which I didn't know existed until it occurred to me that it might.

## #9 Re: Help Me ! » Error Intervals » 2024-05-25 10:55:28

I suspect that rounding might come into this...

I've never heard of error intervals, but rounding is uppermost in my mind atm because I'm working on a tricky problem where rounding is critical in finding solutions.

## #10 Re: Introductions » Old Faces, New Outlook. » 2024-05-20 23:51:11

Hi again, Relentless! Still 'Keep_'-ing the old name going, I see.

Yes, I thought you were you, your username being a good clue; + your use the other day of 'M' for Mathematica, the abbreviation that bobbym and I used frequently in our many conversations...and maybe you did in yours with him too.

We met in several threads about 8 years ago, one being The missing dollar (& the 2 extra dollars). Well, the sad news since then is that my HP 32SII that I based the puzzle on conked out 3 years ago. However, I found an HP 33S (HP 32SII's successor) for only \$35, and all's happy again.

Welcome back!

## #11 Re: Computer Math » Project Euler Problems 4-6 » 2024-05-17 21:45:54

Keep_Relentless wrote:

Problem 6 looked really easy so I solved it first.

Yes, that fell into place quite quickly in Excel.

M took me a bit longer to suss out...even though the code looks pretty simple.

## #12 Re: Computer Math » Project Euler Problems 4-6 » 2024-05-17 21:06:52

Keep_Relentless wrote:

I did problem 5 with Excel too

Edit: Problem 4 as well.

I couldn't think of an easy enough way in Excel, so went with M:

## #13 Re: Computer Math » Project Euler Problems 1-3 » 2024-05-17 18:41:54

Keep_Relentless wrote:

I did problem 2 on Excel too, manually. There are only 32 terms of that Fibonacci sequence less than four million.

Yes, I solved it with Excel...and just now in M.

## #14 Re: Computer Math » Project Euler Problems 4-6 » 2024-05-17 16:19:50

Keep_Relentless wrote:

By the way the website asks you not to post the answers.

I'd overlooked what you said there. I haven't posted any answers as such, just code...but running the codes will give the answers.

Shall I continue posting the way I have, or change somehow?

From their website:
"Who are the problems aimed at?
The intended audience include students for whom the basic curriculum is not feeding their hunger to learn, adults whose background was not primarily mathematics but had an interest in things mathematical, and professionals who want to keep their problem solving and mathematics on the cutting edge."

I fit into the italicised category.

## #15 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-17 13:43:56

phrontister wrote:
Keep_Relentless wrote:

A way to do problem 8 occurred to me. Let's give it a go.

Edit: Problem 8 done. Still no coding used.

Here's what I did:

This morning I worked out an M solution:

## #16 Re: Computer Math » Project Euler Problems 1-3 » 2024-05-17 01:41:38

Keep_Relentless wrote:

I did problem 1 on Excel....So ideally this question should be answered by programming.

I coded it up in LibertyBASIC (it'll run in the freeware Just BASIC too):

No clever maths, just loops...which is all I can manage this time of night!

## #17 Re: Computer Math » Project Euler Problems 10-12 » 2024-05-17 00:44:31

Keep_Relentless wrote:

Problem 11 could be done on Excel but I think it would take annoyingly long if I'm not missing something. I'm going to go ahead and guess that it's the diagonal 89 * 94 * 97 * 87.

That's what I got, using Excel.

Copy/paste into Excel via the Wizard refused to work, but first pasting into Notepad++ and then copy/paste from there woke the Wizard up, and the grid copied over properly with the numbers in their respective cells.

That helped greatly with finding the solution via formulas that I could copy/drag with the fill handle.

## #18 Re: Computer Math » Project Euler Problems 10-12 » 2024-05-16 23:14:43

Keep_Relentless wrote:

Problem 12 done with Mathematica. Would be very surprised if it could be done with Excel.

Yes, I'd also be very surprised, given the huge numbers. But maybe an Excel whizz could...

I also solved it with M.

Verified the solution in Excel via a UDF that gave all the divisors, and a formula that counted the number of divisors. Both helps were found on the net. Also, I needed the triangular number from the M solution because of the huge numbers.

## #19 Re: Computer Math » Project Euler Problems 10-12 » 2024-05-16 21:27:11

Keep_Relentless wrote:

10. The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million.

Problem 10 done on Mathematica.

Found quite a neat 1-liner (with 4 functions) solution in M. Verified the solution in Excel.

## #20 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-16 01:55:00

Keep_Relentless wrote:

I got problem 9 with a mixture of Mathematica and Excel.

In case there's a way of explaining what M spit out regarding problem 9, I will share its result:

Your 500(2-√2)<b<500 is close to what I did, but I don't understand the other two. Sorry.

But here's how I solved it in M:

I didn't reinvent the wheel there...just used my BASIC strategy, which was my first solution method.

And here's my BASIC code:

Coded in Liberty BASIC, but also runs in Just BASIC (junior freeware version of LB).

I also worked out a not-too-tedious Excel solution (it looks more laborious than it is):

I hope those Excel instructions work for you!

## #21 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-16 00:05:04

Keep_Relentless wrote:

Is it considered cheating if you use Mathematica?

I hope not, coz I've used it on a couple of Project Euler problems posted years earlier here on MIF...and I didn't give it a moment's thought then!

However, it did cross my mind that M's 'Prime[10001]' solution was borderline cheating!

By this criterion, if I understand the sieve of eratosthenes, to cross out the multiples of every prime, I have a (laborious) method I could potentially carry out on pen and paper. So it is not really a mystery how the computer arrives at the answer.

Agreed.

Here's my clunky SofE code:

This is the Liberty BASIC code I referred to in post #8. LB costs \$\$, but the code also runs in Just BASIC v2.0, which is a scaled-down freeware version of LB.

I said previously that the code's 'clunky'. That was because I couldn't work out how to terminate iterations at the 10001st prime, and instead chose 'size=52370', which gives the solution that M gave! Btw, 52370*2 + 3 = that solution!

Edit: I forgot to say that the code will give just the 10001st prime. If you also want to print all the primes (which greatly slows down the operation), delete the 'Rem' tick preceding the two PRINT statements that have them, and place a Rem tick in front of the last PRINT statement.

## #22 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-15 10:47:54

Keep_Relentless wrote:

7. By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? [Without looking it up.]

The Excel solution I mentioned in post #5 is a single column one that lists all the primes to the 10001st.

Mathematica has a 1-word function for returning just the 10001st prime.

My Liberty BASIC program came with a 'Sieve of Eratosthenes' module, which I adapted (clunkily) to return these options:
(a) just the 10001st prime, or
(b) all primes up to and including the 10001st.

## #23 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-15 01:31:38

Keep_Relentless wrote:

These ones are trickier. It might be time to actually start coding.

I agree...and I solved #9 with a small BASIC code a couple of minutes ago.

## #24 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-14 01:14:41

Hi Keep_Relentless;

I did #7 on Excel spreadsheet, but, after failing to come up with anything myself, cheated by using a UDF I found on the net that helped (but I won't reveal what/how, yet).

## #25 Re: Computer Math » Project Euler Problems 7-9 » 2024-05-14 00:59:08

Keep_Relentless wrote:

A way to do problem 8 occurred to me. Let's give it a go.

Edit: Problem 8 done. Still no coding used.

Here's what I did: