+ 1

Next number generator with two digits

eg1: 3 and 4 are the two digits then the next number generation is 34,43,334,343,344,434,....... eg2: 5 and 0 are the two digits then the next number generation is 50,500,505,550,.......

31st May 2017, 8:48 AM
<Tharun Kumar>
<Tharun Kumar> - avatar
4 Réponses
+ 1
thanks @ michal I got ur logic but I don't want same digits repeating like 11 111 1111
31st May 2017, 9:06 AM
<Tharun Kumar>
<Tharun Kumar> - avatar
+ 1
thank you Michal got it
31st May 2017, 9:20 AM
<Tharun Kumar>
<Tharun Kumar> - avatar
0
what is the problem ? this generator is quite simple if you think of it as of binary counter: 0 - 0 1 - 1 2 - 10 3 - 11 4 - 100 5 - 101 6 - 110 7 - 111 8 - 1000 9 - 1001 10 - 1010 11 - 1011 etc.. then just replace '1' and '0' with your symbols
31st May 2017, 9:00 AM
Michal
Michal - avatar
0
while counting you can test for the value of power(2,i)-1 (it's 11 111 1111 11111 value) then remove the value, increment i pseudocode: i = 0; value = 0; loop { if (value == power(2,i)-1) i++; else youhavebinvalue; value++; } i think it's quite fast algorithm
31st May 2017, 9:18 AM
Michal
Michal - avatar