[Mathematica] Number problem with digits

  • Mathematica
  • Thread starter adjacent
  • Start date
  • Tags
    Mathematica
In summary: If(LHS == RHS)Then a*100+b*10+cElse False, for {a,0,9} ,{b,0,9}, {c,0,9}Yes, this is what you are looking for.
  • #1
adjacent
Gold Member
1,552
63
Determine all three-digit number ,##N##, having the property that ##N## is divisible by 11, and ##\frac{N}{11}## is equal to the sum of the square of the digits of ##N##.

This cannot be solved just by guessing. I think I should use mathematica for this,but, this sum of the digits is a scary thing. Does mathematica has a feature for that?

I know that
-##N## is a multiple of 11.

Let the digits of ##N## be ##a,b \text{ and } c## respectively.
Now, ##11(a^2+b^2+c^2)=abc##
I can't think of a way.
 
Physics news on Phys.org
  • #2
Hint: You don't want ##abc##. That's not ##N##. That's the product of ##a##, ##b##, and ##c##. You want something else, an expression that yields ##N## given ##a##, ##b##, and ##c##.
 
  • #3
D H said:
Hint: You don't want ##abc##. That's not ##N##. That's the product of ##a##, ##b##, and ##c##. You want something else, an expression that yields ##N## given ##a##, ##b##, and ##c##.

Yes, that's what is confusing me. I really can't think of anything. The only expression I can think of is something like : ##a,b,c## :confused:
Any hints?

##a##,##b## and ##c## should be each less than 10.
 
  • #4
adjacent said:
Yes, that's what is confusing me. I really can't think of anything. The only expression I can think of is something like : ##a,b,c## :confused:
Any hints?

##a##,##b## and ##c## should be each less than 10.
Well, think of an example, say [itex]234[/itex], two hundred and thirty four. What does the [itex]2[/itex] mean? What does the [itex]3[/itex] mean? It's not true that[tex]234 = 2 \times 3 \times 4[/tex]. Can you think of another expression involving [itex]2[/itex], [itex]3[/itex], [itex]4[/itex], and some other numbers?
 
  • #5
DrGreg said:
Well, think of an example, say [itex]234[/itex], two hundred and thirty four. What does the [itex]2[/itex] mean? What does the [itex]3[/itex] mean? It's not true that[tex]234 = 2 \times 3 \times 4[/tex]. Can you think of another expression involving [itex]2[/itex], [itex]3[/itex], [itex]4[/itex], and some other numbers?

Hmm, What are you trying to imply here?
##2 \times 3 \times 4 =24## but ## 2 \times 3 \times 3 \times 13 = 234##
I can't reproduce the number 234 by multiplying it's digits only. If I am to add division, subtraction,etc, then this will turn out to be impossible
 
  • #6
What does 234, two hundred and thirty four, mean? What mathematical magic let's us write that number as 234 (as opposed to CCXXXIV, or even worse, 234 tick marks)?
 
  • #7
Like they're all trying to get you to ask yourself:

What does 234 mean. What number system is this. How could I possibly represent this number algebraically in terms of its digits. Why do we write it in this way? Why not 11101010? Why not EA?

Its MUCH easier than you realize, and because of this you might be over-thinking it.

Once you get to the programming part we can show you how to do the loop over all possible combinations of numerals, and how to check if it follows your rules.
 
  • #8
Hepth said:
What does 234 mean. What number system is this. How could I possibly represent this number algebraically in terms of its digits. Why do we write it in this way? Why not 11101010? Why not EA?
The number system we use is based on the number 10.
When a digit increases to 10, then that digit will become 0 and +1 will be added to the digit on the left side.
So for example, if we have a number ##10_40_30_20_1## (I added sub numbers for explanation)
Numbers in the position ##0_1## are called ones, ##0_2## are called tens and so on.
If the digit ##0_1## increases to ##10##, that digit will become 0 and to the digit next, on the left side(##0_2##), a one will be added.

Hope you understand what I mean. Is this what you are asking for?
 
Last edited:
  • #9
Not sure what you mean, but you are finally mentioning things that are required to solve the problem. You are just still overthinking it.
 
  • #10
Borek said:
Not sure what you mean, but you are finally mentioning things that are required to solve the problem. You are just still overthinking it.

I really don't understand what you are trying to say. I have mentioned everything I know about this numeral system.
Can you tell me exactly where I am over-thinking?
:confused::confused:
 
  • #11
As this is not a homework forum ill just break the unspoken rule and ask if writing

4867 = 4*1000+8*100+6*10+7

can help you. You're on the right track but overthinking it.
 
  • Like
Likes 1 person
  • #12
Hepth said:
As this is not a homework forum ill just break the unspoken rule and ask if writing

4867 = 4*1000+8*100+6*10+7

can help you. You're on the right track but overthinking it.
Thank you so much! Why couldn't you say this earlier?

I will transform my previous equation to match with this.
##11(a^2+b^2+c^2)=(a \times 100)+(b \times 10)+(c \times 1)##
That means ##11(a^2+b^2+c^2)=100a+10b+c##
Now I will have to do WHAT? Brute force?
 
  • #13
Yes. Brute force is easiest if you only have 3 digits.

Did a table over If(LHS == RHS)
Then a*100+b*10+c
Else False
, for {a,0,9} ,{b,0,9}, {c,0,9}

Then I deletecases those that are false. I think there were very few cases.
 
  • #14
Hepth said:
Did a table over If(LHS == RHS)
Then a*100+b*10+c
Else False
, for {a,0,9} ,{b,0,9}, {c,0,9}

Then I deletecases those that are false. I think there were very few cases.

What? Can you please elaborate your post?

P.S I am a beginner in programming( Self learning)
 
  • #15
adjacent said:
Thank you so much! Why couldn't you say this earlier?

This is the very definition of the positional numeral system that you apparently know how to use. We all hoped you are just overthinking it and this equation is obvious to you.
 
  • #16
Borek said:
This is the very definition of the positional numeral system that you apparently know how to use. We all hoped you are just overthinking it and this equation is obvious to you.
I was never taught that. Anyway, I will keep that definition in my mind from now on. :smile:
 
  • #17
adjacent said:
I was never taught that.

So how do you know how much is 123?
 
  • #18
Borek said:
So how do you know how much is 123?

It is 100+20+3
1 is the hundreds, 2 is the tens, and 3 is the ones.
So now with this new knowledge,it's ##(100 \times 1)+(10 \times 2)+(1 \times 3)##

I think I knew the knowledge but didn't know how to apply it. There were taught in grade 1, more than 9 years ago.

Anyway, how will we proceed with this problem now?
 
  • #19
Hepth said:
As this is not a homework forum ill just break the unspoken rule and ask if writing

4867 = 4*1000+8*100+6*10+7

can help you. You're on the right track but overthinking it.
Even with homework problems there's a point where a bigger hint is acceptable, and sometimes even a big huge hint is OK. At this point, it's rather obvious that adjacent is struggling, so telling him what 4867 was entirely acceptable.

adjacent said:
Thank you so much! Why couldn't you say this earlier?
What 4867 means is very, very basic. Given that you are dabbling with a number theory problem here, we all expected that you would know what 4867 means.

I will transform my previous equation to match with this.
##11(a^2+b^2+c^2)=(a \times 100)+(b \times 10)+(c \times 1)##
That means ##11(a^2+b^2+c^2)=100a+10b+c##
Now I will have to do WHAT? Brute force?
This is a quadratic Diophantine problem in three variables. One simple solution is to ask Mathematica to solve ##11(a^2+b^2+c^2) == 100 a + 10 b + c## over the integers. That will give solutions such as a=0, b=0, c=0 and a=3,b=-1, c=-4 that you might want to exclude. You can exclude those with additional expressions to constrain a to the positive integers and b and c to the non-negative integers.

Suppose you want to try solving this without using Solve. One simple solution is to look at all 900 numbers of the form abc with 0<a≤9, 0≤b≤9, and 0≤c≤9. Learn to use Mathematica's list functions. That's extreme brute force, but with only 900 elements it's not going to take too long.

You can do much better than this. Your expression is the equation of a sphere. That expression can be rewritten as ##(a - \frac{100}{22})^2 + (b - \frac{10}{22})^2 + (c-\frac{1}{22})^2 = \frac{10101}{484}##. That's a sphere with radius ##r = \sqrt{10101}\,/22## and center ##(100/22, 10/22, 1/22)##. That means ##(100-\sqrt{10101})/22 \le a \le (100+\sqrt{10101})##, ##(10-\sqrt{10101})/22 \le b \le (10+\sqrt{10101})/22##, and ##(1-\sqrt{10101})/22 \le c \le (1+\sqrt{10101})/22##. Since you are interested in integer values with ##a>0##, ##b,c \ge 0##, this means you only need to look at nine values for a, six for b, and five for c. That reduces the 900 (a,b,c) triples that need to be examined using the first brute force method to only 270 triples.

You can do much better than this. Clearing the denominator in the canonical spherical expression for this problem yields ##(22a - 100)^2 + (22b-10)^2 + (22c-1)^2 = 10101##. Denoting ##u=|22a-100|, v=|22b-10|, w=|22c-1|##, this can be written as ##u^2+v^2+w^2=10101##. This is a sum of three squares problem! Ignoring permutations of (u,v,w) and changes in sign, there are only 20 values of (u,v,w) that satisfy ##u^2+v^2+w^2=10101##. Filtering on the five possible values of w=|22c-1|=(1,21,43,65,87) for c=(0,1,2,3,4) yields just five (u,v,w) triples that need to be investigated, three for w=1 (c=0) and two for w=65 (c=3).

The Mathematica function PowersRepresentations give you the 20 integer solutions to ##u^2+v^2+w^2=10101##. I'll leave filtering those to yield the desired solutions to your problem up to you.
 
Last edited:
  • Like
Likes 1 person
  • #20
adjacent said:
It is 100+20+3
1 is the hundreds, 2 is the tens, and 3 is the ones.
So now with this new knowledge,it's ##(100 \times 1)+(10 \times 2)+(1 \times 3)##

I think I knew the knowledge but didn't know how to apply it. There were taught in grade 1, more than 9 years ago.
Yes, you were taught this 9 years ago, but you have several years to go before you learn the deep magic behind this. That's something you'll learn in abstract algebra, a class you can take in college but only after taking the first three calculus classes.

Without having taken abstract algebra, you're more than a bit over your head trying to solve number theory problems.
 
  • #21
To elaborate on what others in this thread have said, the positional representation of a number like

123

for example can be converted into a polynomial, where each numeral represents the coefficient of a different power of 10 (for decimal representation; the same principle applies for other bases, like octal [base = 8] or hexadecimal [base = 16]).

So, to fully expand '123':

123 = 1 * 10^2 + 2 * 10^1 + 3 * 10^0

If we have a decimal number in need of representation, say 123.456, the principle can be extended using negative powers of the base, like this

123.456 = 1 * 10^2 + 2 * 10^1 + 3 * 10^0 + 4 * 10^-1 + 5 * 10^-2 + 6 * 10^-3

A word of advice about math: it's cumulative, so you have to remember what you learned 9 years ago or however long it was (which time will increase as you grow older), because, chances are, you will be stumbling over these concepts again and again.
 

1. What is a number problem with digits in Mathematica?

A number problem with digits in Mathematica is a mathematical puzzle or question that involves manipulating and rearranging numbers using various operations to arrive at a specific result or pattern.

2. How do I solve a number problem with digits in Mathematica?

To solve a number problem with digits in Mathematica, you can use the built-in functions such as IntegerDigits and FromDigits to convert numbers into lists of digits and vice versa. Then, you can use other functions like Permutations and Apply to manipulate the digits and find the desired result.

3. Can Mathematica handle complex number problems with digits?

Yes, Mathematica can handle complex number problems with digits. It has built-in functions for working with complex numbers, such as Re and Im for extracting the real and imaginary parts, as well as Conjugate and Abs for finding the complex conjugate and absolute value.

4. Are there any tips for solving number problems with digits in Mathematica?

One tip for solving number problems with digits in Mathematica is to break down the problem into smaller parts and use List and Map functions to manipulate the digits. Also, it can be helpful to use Table to generate multiple lists of digits and then apply operations to them simultaneously.

5. Can I use Mathematica to create my own number problems with digits?

Yes, you can use Mathematica to create your own number problems with digits. You can use functions like RandomInteger and RandomSample to generate random numbers and manipulate them to create a unique problem. Additionally, you can use StringJoin and ToString functions to create specific number patterns.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
4
Views
210
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
2K
  • Programming and Computer Science
Replies
1
Views
952
  • General Math
Replies
2
Views
1K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • Precalculus Mathematics Homework Help
Replies
6
Views
828
Back
Top