News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Diophantine linear equation system

Started by Gunther, December 29, 2023, 09:31:37 AM

Previous topic - Next topic

NoCforMe

So, it's basically a brute force technique.
How about applying some of the logic that was shown in that YouTube video that Jack posted here? Is that possible?
Assembly language programming should be fun. That's why I do it.

HSE

Quote from: NoCforMe on January 03, 2024, 11:02:17 AMSo, it's basically a brute force technique.
How about applying some of the logic that was shown in that YouTube video that Jack posted here? Is that possible?


Yes. AI solution  :biggrin:

No video... yet  :rolleyes:
Equations in Assembly: SmplMath

raymond

Here was my approach to solve it within minutes, using logic which AI does not have.

1st, as did AI. was to subtract the two equations.

1. x  + yz = 2024
2. xy + z  = 2023
______________
x + yz -xy - z = 1

2nd, group some unknowns together as follows (where AI is lacking):

(yz-z) - (xy-x) = 1
z(y-1) - x(y-1) = 1
(z-x)(y-1) = 1

Then it's a simple matter to observe that both components of the multiplication must be integral values based on the problem definition, AND, the only way for the equation to be true is if both are being equal to 1 (AI does not yet seem able to make such observations and deductions).
Therefore, y = 2
and, z = x+1

Replacing those values in the second equation (xy+z=2023),
2x + (x+1) = 3x+1 = 2023
             3x = 2023-1 = 2022
              x = 2022/3 = 674
 and then     z = x+1    = 675
 :greenclp:


Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com

HSE

#18
Hi!

I can sleep, but I have another solution:

  ay + (1 + a) = 2023

Anyway some brute force, testing first 3 integer results for y sequence :biggrin: (is the second)

Loops solution take me 10 minutes, this hours. Perhaps, Raymond solution could take me weeks  :biggrin:

Fantastic  :thumbsup:  (I hope to sleep now)

Later: Mmm, not so clear.

I solve " a = (2023-1)/(1+y) " for " y = 1, 2, 3, 4, etc:thumbsup:
Equations in Assembly: SmplMath

Gunther

Raymond,

Quote from: raymond on January 03, 2024, 03:11:00 PMHere was my approach to solve it within minutes, using logic which AI does not have.

precisely. These are the right steps.
  • Subtraction of both equations.
  • A clever factorization.
  • In the end, it's clear that both factors must be equal to -1.
None of this is witchcraft.
You have to know the facts before you can distort them.

daydreamer

At uni we learned matrices xyzw way of solve things,is that  possible Gunther?
Fastest way for humans to calculate things is autistic math talent,like in that Tom Cruise movie
@raymond
Now when you posted solution on the net you might have taught AI to solve it  :biggrin:

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding