well , I tried to solve it from Maths

though half way through only :(

N = number required i.e. (10^k -1)/9
given n = 10x + 3

by eq

(10x + 3) * m = N= (10^k - 1)/9

implies

k = 2log 3 + log m + log(10x + 3)
i.e.
k > 1 + log n

This gives the lowerbound on minimum number of 1 to be start with, but
seeing the logarithmic eq, this simply seems not to add much value.

can any one figure out for upper bound ?



On Oct 12, 5:18 pm, anshu mishra <[email protected]> wrote:
> @amol
> I was not sure that for every number that has 3 in its unit place has one
> multiple which has all one. So I used that is if the remainder is coming
> that already appeared stop there coz it will make stuck in a loop.
> for ex. remainders are
> 1 3 19 23 37 1 3 19 .... that will repeat.
>
> but it in this case u can remove the set. Code will look more simpler.
>
> string all1Multiple(int x)
> {
> string s;
> int r=1;
> do
> {
> s += '1';
> r = r % x;
> r = r * 10 + 1;
>
> } while(r != 1);
> return s;
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to