Public Group

Unknown string of numbers..

This topic is 2028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

//

Edited by Vidar son of Odin

Share on other sites

How did you found this string? It's an excercise from a book or something? Or you know a crazy man how repeats them? If it's the latter, don't us them to win the lottery!

Anyway, if it's really supposed to be a sequence with some logic it also depends if it's a learning excercice or a lateral thinking excercise.

The only points I can see are:

• Every number contains a 9
• After a number composed of all 9's a new digit is added
• For a certain number of digit, the valid values for each digits are 1 less than the valid values (1 digit > 9, 2 digits > 8 and 9, 3 digits > 7, 8 and 9).
• It looks like if a number starts with 9, the next number has the first 2 digits swapped.
• I have no idea of more rules, but clearly there are more things going on (why is it 899 the next number? no idea)

So, for the next number I'd guess is something like 6789 and the next one maybe 6798, but it's just a guess, there's no function or arlgorithm I can think of.

Share on other sites

Found it, thanks to DiegoSLTS observations...

Every time a new digit is added.

First you start with a nine, you can't swap anything there. Then you add a second digit and you allow numbers 8 and 9. Then you have three possibilities if every number should include at least one 9: 98, 89 and 99. After that you add another digit. The numbers allowed are 7, 8 and 9 like DiegoSLTS said. All numbers should again not have two times the same number except for the nine.

9

89 98 99

789 798 879 897 899 978 987 989 998 999

As you can see the numbers are grouped in terms of number of digits. The first number starts with the lowest digit first. The last number contains only nines. Aside from that I don't see the exact order inside a "digit group". But it looks like the order "prefers" lower digits first. Is this the pattern or is there also a pattern inside the groups?

Edited by ProtectedMode

Share on other sites

Those are the numbers whose histograms of digits are weakly increasing.

perl -e 'NUMBER: for $n (1..1000) {%c=(); for$d (split "",$n){$c{$d}++}; for$d (1..9) {next NUMBER if $c{$d} < $c{$d-1}} print "$n\n"}' Share this post Link to post Share on other sites (retracted, was slightly wrong) Edited by Nypyren Share this post Link to post Share on other sites Those are the numbers whose histograms of digits are weakly increasing. perl -e 'NUMBER: for$n (1..1000) {%c=(); for $d (split "",$n){$c{$d}++}; for $d (1..9) {next NUMBER if$c{$d} <$c{$d-1}} print "$n\n"}'

Could you maybe provide the output too for people who don't have Perl installed?

Share on other sites

Outer loop seed = {9, 89, 789, 6789, ... 123456789, MAYBE 0123456789 }

Inner loop:  Take the digits you have available (for example with 789, you have the digits 7,8, and 9 to work with) and find the next higher integer with the same number of digits which uses only the digits you have available.  Terminate the inner loop when all digits are 9.

Your method would produce 877, but that wasn't in the list.

Share on other sites

Those are the numbers whose histograms of digits are weakly increasing.

• 9
• 11
• 15
• 21
• 26