wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> hard >> Tricky Sequence
(Message started by: navdeep1771 on May 15th, 2018, 1:03am)

Title: Tricky Sequence
Post by navdeep1771 on May 15th, 2018, 1:03am
Find the 1000th Term of the Sequence:-

1,3,5,7,9,11,13,15,17,19,31,33,35,37,39,51.....and so on.

Note:-
1. Yes, there is "31" after "19"
2. It's a completely logical problem with a logical solution.

Title: Re: Tricky Sequence
Post by Grimbal on May 15th, 2018, 5:07am
If there were a 7 then it would be all numbers with only odd digits.

Title: Re: Tricky Sequence
Post by navdeep1771 on May 15th, 2018, 8:18am
Sorry @Grimbal for that mistake. I was in little hurry when I posted this question.
Well, I modified it and you can try it now again.

Title: Re: Tricky Sequence
Post by Grimbal on May 16th, 2018, 5:19am
That's a tough one.  Maybe [hide]all integers with only odd digits[/hide]?

Title: Re: Tricky Sequence
Post by towr on May 16th, 2018, 1:14pm
Well, in that case, the 1000th one would be [hide]13779[/hide]

[hide]The easy way to find it is just run a script.
The clever way to find it is to notice it's basically the integers in base five, but encoded with odd digits instead of consecutive digits.

(1+1)/2 * 5 4 + (3+1)/2 * 5 3 + (7+1)/2 * 5 2 + (7+1)/2 * 5 1 + (9+1)/2 * 5 0  = 1000
[/hide]

Title: Re: Tricky Sequence
Post by Grimbal on May 17th, 2018, 5:36am
Err...  It seems that after reaching the first stumbling block, I didn't even read the end of the question.

[hide]There are 5 1-digit, 25 2-digit, 125 3-digit and 625 4-digit numbers.  A total of 780.  781st number is 11111.  To get the 1000th, convert 1000-781 to base 5 and replace 01234 by 13579.
1000-781 = 219.  In base 5 it is 01334
Replacing digits gives 13779[/hide]

Towr is actually cheating.  1000 in base 5 is 13000.  His so-called base 5 uses digits 1-5 and not 0-4.  Which is actually cleverer than what I did.
- But it is cheating.
- Is it?  But it works.
- Yeah... it is the Kobayashi Maru all over again.

Title: Re: Tricky Sequence
Post by towr on May 17th, 2018, 10:12am
Well, as I said (or at least suggested), I first found the answer just by running a simple loop over all numbers and counting the ones with only odd digits.

The other way I found to get the answer is to convert to base 5, replace all 0s with 5s by borrowing from the preceding digit, and then double every digit and subtract 1.
[hide]
100010 -> 130005 -> 124455+ -> 137795odd
62510 -> 100005 -> 44455+ -> 77795odd
78010 -> 111105 -> 55555+ -> 99995odd
[/hide]

Title: Re: Tricky Sequence
Post by navdeep1771 on May 17th, 2018, 11:45am
Well done guys!
[hide] 13779 is the correct answer. [/hide]
So you both (grimbal and towr) are correct and towr is really very clever.
Well, I solved this problem with the same way as of grimbal. But yeah towr's approach is hard to get clicked.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board