Wednesday, November 30, 2016

Interesting Questions

Question 1

Divide a circle into 6 sectors. Write 1,0,1,0,0,0 in each sector. A move consists of incrementing neighbouring numbers, can we get all numbers in the circle to be equal by a sequence of these moves?

I tried brute force and as intuition seems to suggest, this isn’t possible.

import operator
def splAdd(a,b):
    return(tuple(map(operator.add, a, b)))

def move(n):
        if(n.count(n[0]) == len(n)):

start = (1,0,1,0,0,0)


Question 2

Of all the sets of integers whose sum is 1000, what’s the set which has maximum product?

Solution 2

Consider , does or contribute more to the size of ? This is what I was first faced with. I could take ’s and its sum would be . Here the product would be . If you thought contributed more you would go with this.

Say you thought was more important, in this case ’s would sum to . Note the product here is .

Even though we humans are naturally bad at grasping enormous numbers, We can write as which is obviously less than .

Ok as some of us might have guessed, its better to multiply more of a smaller number than to multiply a larger number more number of times.

Multiplication is repeated Addition, while Power is repeated Multiplication.

But is still not the answer. Let us divide (a constant) evenly into pieces (each of size ). So we wish to maximize the product

is maximum. Note how and .

To maximize , we differentiate and equate that to .

So you can see how no matter what the sum is (doesn’t have to be ) the maximum product is when , But we can’t choose as it’s not a Integer. So we choose the nearest integer to i.e. .

So the ideal answer should be full of ’s. But as we can take ’s then we would have to take as the last integer and this sucks for maximizing product. So ’s and ’s is optimal as .

In the case that then we should take number of’s and a single .

Question 3

A dragon has heads, A soldier can cut off heads but then will grow back, he can cut off heads but then will grow back. He can also cut off heads but then will grow back. Will the dragon ever die if the soldier tries various combinations of these moves? If so how?

Solution 3

Move causes a change in heads.
Move causes a change in heads.
Move causes a change in heads.

Say we do number of move , number of move , and number of move . The net change is,

We want to find integer values for such that . Solving for it,

will also be a integer, say .

As a fraction plus a integer can never be a integer, so we can be sure there exists no integers such that the above equation is satisfied.

The dragon can never be killed

Question 4

What is the remainder when you divide (here is repeated 16 times, has digits) with ?

Solution 4

The first key insight is to remember how the divisibility rule for (which happens to also be used for ) was derived. If a decimal number has the digits then,

We know that is always divisible by . So if is divisible by , the whole number is divisible by .

Coming to this problem, we need to divide with . Which peculiarly divides as shown below,

So it leaves a remainder of periodically with powers of , unlike which was nice enough to only leave as a reminder - this had helped us isolate just the digits from .

So our in terms of its digits would be,

We can’t separate any multiples of from the first digits, so let’s write,

We can separate digits based on which power of accompanies them - .

Here we needed to find out how many elements are there in the set . One way is to calculate for in the AP equation . So , .

We can do by hand and get the answer .

The remainder is 786

Question 5

There is a set containing , we proceed to continuously select (at random) numbers ( and ) then compute the number . We remove both and while we add to this set. Finally what will the final remaining number be?

Solution 5

Note that

So now the operation becomes “selecting (at random) numbers ( and ) then compute the number . We remove both and while we add to this set”.

So for , after the first operation it would become
which is same as . So on repeatedly applying this operation we get

So you get where this is going,

The final term will be

So for as given in the question means that the final term will be,

Question 8

Find n, where . is the digital sum of .

Digital sum is the digit sum of . I was baffled by this term, for it was the first time I had heard it.

Solution 8

We know that So as all terms are positive, can be at max a digit number. Any larger than that and the sum will overshoot .

It can’t be a digit number either as even if is the largest digit number,

So expressing using it’s digits, ,

We can see that the sum of 3 digits cannot exceed a 2 digit number, let

So the given equation will be,

Now we can be sure is not possible as even for , . So substituting ,

So we can be sure there exists no integers such that the above equation is satisfied.

I wrote a code in python to try and brute force the solution,

# To find n such that n + d(n) + d(d(n)) = 1000
def d(i):
    sum = 0
    for j in str(i):
        sum = sum + int(j)

for i in range(900,1000):
    print("\n\nThis is for "+str(i)+"\n")

Final Answer:

No such exists

1) 101000 in a circle (6 sectors). Add one to neighbouring numbers, can we get all numbers to be equal.
NO, but why…?

2) Sum of a set of integers is 1000, what’s the maximum possible product of these integers?

3) Will the dragon die? ( -15, 9, -9 ) ( -24 +15), (-17, +2) , (-20 +11)

4) Smallest multiple of 9 with all even digits?

5) couples in a village, keep copulating until a boy is born, how does the boy:girl ratio change?

6) ( 16 times ) % 999 ( what’s k? )

7) where

No exists such as to satisfy this equation.

9) What’s the output of this program?

def f(n): 

“hello” followed by “world”

10) Find the 100 largest numbers in a set of numbers?
heap ds

11) Find a set of 20 positive integers such that for all (maybe any?) subset of that set the sum of the elements in that subset is a perfect number?

12) There is a set containing , remove 2 numbers and at random from this set then add the number to this set. Finally what number will be remaining?

13) How many 36 digit numbers exist which are not divisible by 100?

Written with StackEdit.