Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4117260
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:48:46+00:00 2026-05-20T22:48:46+00:00

Let me start off by clarifying that(before you guys dismiss me), this is not

  • 0

Let me start off by clarifying that(before you guys dismiss me), this is not a homework problem and I’m not a university student. 🙂

EDIT
Thanks to @Klas and others, my question now boils down to a mathematical equation which needs to be solved programmatically.

I’m looking for an algorithm/code which solves Linear Diophantine Equation.
For lesser mortals like me, here’s how such an equation looks like:

Example 1: 3x + 4y + 5z = 25 (find all possible values of x,y,z)

Example 2: 10p + 5q + 6r + 11s = 224 (find all possible values of p,q,r,s)

Example 3: 8p + 9q + 10r + 11s + 12t = 1012 (find all possible values of p,q,r,s,t)

I tried googling to no avail. I would have thought that some code would already be written to solve this. Do let me know if you guys have come across some kind of library which has already implemented this. And if the solution is in Java, nothing can be cooler!. Algorithm/pseudo code will also do. Thanks much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:48:46+00:00Added an answer on May 20, 2026 at 10:48 pm

    Brute-force recursion is an option, depending on how large you will allow the value or number of values to become.

    Assumptions: The user inputs (the multiplicands) are always distinct positive integers. The coefficients to be found must be non-negative integers.

    Algorithm:

    Of the multiplicands, let M be the largest.
    Calculate C=floor(F/M).
    If F=M*C, output solution of the form (0,0,...,C) and decrement C
    If M is the only multiplicand, terminate processing
    Loop from C down to 0 (call that value i)
      Let F' = F - i*M
      Recursively invoke this algorithm:
        The multiplicands will be the current set minus M
        The goal value will be F'
      For each solution output by the recursive call:
         append i to the coefficient list and output the solution
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start off by saying that I am completely new with WPF (this
Let me start off by saying I'm not having a problem when rotating views
Let me start off by saying that I am not an expert in C.
Let me start off by saying that this is my first real Cocoa app.
Let me start this off by saying that I'm an intern with no Powershell
Before I start off, I'd like to let you know that I'm no Perl
First off, let me start off that I am not a .net developer. The
Let me start off by saying I know this is probably not the correct
Let me start off by saying that this is my first time working with
First off, let me start by saying that I am totally new to working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.