• Congratulations to the Class of 2024 on your results!
    Let us know how you went here
    Got a question about your uni preferences? Ask us here

Official BOS Trial 2014 Thread (2 Viewers)

RealiseNothing

what is that?It is Cowpea
Joined
Jul 10, 2011
Messages
4,591
Location
Sydney
Gender
Male
HSC
2013
Hope carrot doesn't mind me doing this.

We know how much carrot loves putting in questions which have very elegant and quick solutions. So here is a question which has a very elegant and quick solution in preparation for tomorrow's exam. I'll rep if anyone finds the shortest possible solution:



For example take the number 6547, it becomes 6+5+4+7=22, 21 becomes 2+1=3, etc.
 

seventhroot

gg no re
Joined
Aug 3, 2014
Messages
2,803
Gender
Male
HSC
2013
Hope carrot doesn't mind me doing this.

We know how much carrot loves putting in questions which have very elegant and quick solutions. So here is a question which has a very elegant and quick solution in preparation for tomorrow's exam. I'll rep if anyone finds the shortest possible solution:



For example take the number 6547, it becomes 6+5+4+7=22, 21 becomes 2+1=3, etc.
can we write a computer program to do it?
 

Kurosaki

True Fail Kid
Joined
Jul 14, 2012
Messages
1,167
Location
Tubbytronic Superdome
Gender
Male
HSC
2014
Hope carrot doesn't mind me doing this.

We know how much carrot loves putting in questions which have very elegant and quick solutions. So here is a question which has a very elegant and quick solution in preparation for tomorrow's exam. I'll rep if anyone finds the shortest possible solution:



For example take the number 6547, it becomes 6+5+4+7=22, 21 becomes 2+1=3, etc.
Not sure if correct tho:

Consider 1 digit numbers. Sum is 1+2+3+...9
Consider 2 digit numbers. Sum is 10(1+2+....+9) + 10(0+1+2+3+...+9) (due to the two digits)
etc

then add the sum of all these?
 

Speed6

Retired '16
Joined
Jul 31, 2014
Messages
2,949
Gender
Male
HSC
N/A
It would be pretty easy to set a for loop to count it all up haha.



This. In the end the computer will do a million times more calculations than you need to as a human. Think about all those poor electrons!
lol electrons are working very hard.
 

RealiseNothing

what is that?It is Cowpea
Joined
Jul 10, 2011
Messages
4,591
Location
Sydney
Gender
Male
HSC
2013
alright; I'll write it in C

do you mean like

1 + 2 + 3 + 4 + ... + 321 + 322 + ... + 1,000,000

becomes

1 + 2 + 3 + 4 + ... + 3+ 2 + 1 + 3 + 2 + 2 + ... + 1 + 0 +...

?
Exactly.

Not sure if correct tho:

Consider 1 digit numbers. Sum is 1+2+3+...9
Consider 2 digit numbers. Sum is 9(1+2+....+9) + 9(1+2+3+...+9) (due to the two digits)
etc

then add the sum of all these?
That works, but there is a faster method.
 

seventhroot

gg no re
Joined
Aug 3, 2014
Messages
2,803
Gender
Male
HSC
2013
This. In the end the computer will do a million times more calculations than you need to as a human. Think about all those poor electrons!
I get a really big number that doesn't look right; I suspect it is a data overflow. what is the number around?

he said digits, so the latter.
soz; no engrish/10

but yeah assumed the latter
 

Sy123

This too shall pass
Joined
Nov 6, 2011
Messages
3,730
Gender
Male
HSC
2013
Hope carrot doesn't mind me doing this.

We know how much carrot loves putting in questions which have very elegant and quick solutions. So here is a question which has a very elegant and quick solution in preparation for tomorrow's exam. I'll rep if anyone finds the shortest possible solution:



For example take the number 6547, it becomes 6+5+4+7=22, 21 becomes 2+1=3, etc.
Imagine writing all these numbers on top of each other, in columns, the 'units' column (the far right), every 10'th number is the same, so you have continuing cycles of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

So in this column, the sum is

The next column, the 'tens' column, has each digit appear in groups of 10 and cycles through all the digits, meaning the sum is:

which is just the same as the first sum

Similar arguments nets us the fact that all the sums for all the columns are the same

So the answer is

 

seventhroot

gg no re
Joined
Aug 3, 2014
Messages
2,803
Gender
Male
HSC
2013
Imagine writing all these numbers on top of each other, in columns, the 'units' column (the far right), every 10'th number is the same, so you have continuing cycles of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

So in this column, the sum is

The next column, the 'tens' column, has each digit appear in groups of 10 and cycles through all the digits, meaning the sum is:

which is just the same as the first sum

Similar arguments nets us the fact that all the sums for all the columns are the same

So the answer is





Every number can be put into the notation of: This will do for all numbers from 0 to 1 000 000
spoiler alert m9; I am trying to code it :(
 

Sy123

This too shall pass
Joined
Nov 6, 2011
Messages
3,730
Gender
Male
HSC
2013
Interpret 'all the numbers from 1 to 1 000 000' as every combination of digits in the 6 digit places

Each digit, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 can occupy it

Pick a random spot for these digits, it is found that if we fix a digit, say

1 xxx x2x

Where the x's are variable, there are 10^5 combinations for this, so the sum of all 2's in this column is 10^5 * 2

This is the same for every other digit, so you get 10^5(1+2+...+9)

The column is arbitrary, so 10^5(1+2+...+9)*6

And then add 1 at the end, getting 2700001

Is this more elegant?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Top