22 is special because it contains the number of its numbers. The next smallest number with this self-accounting property (see A047841) is 10213223. What is the largest such number?

I've figured out the numbers work in pairs, so the number must have an even number of digits, be at least 8 digits and that within each pair, 0 can never be first. Ex. 1002 has a 2, so there can't be 0 2's in the number. Beyond these parameters, I'm not sure how else to approach this problem. I'm was thinking that maybe something could be done with permutations and combinations, since the numbers work as pairs and there are some conditions, but I'm not sure how I would actually do this.

All help is appreciated!

  • 3
    $\begingroup$ This is A047841, next one is $10311233$. Apparently there are $109$ of them. $\endgroup$
    – lulu
    Jan 14 at 18:32
  • 1
    $\begingroup$ How exactly is the "number of numbers" defined ? $\endgroup$
    – Peter
    Jan 16 at 12:45
  • 2
    $\begingroup$ It means self-accounting. 22 has 2 2's, so it has the numbers of its numbers. 10213223 has 1 0, 2 1's, 3 2's and 2 3's so it has the number of its numbers. Each pair (ex. the first 2 digits, 10 for 10213223) works this way, with the first digit (1 in , this case) telling you how many of the second digit (0) are in the number. $\endgroup$
    – user978757
    Jan 16 at 14:53
  • 3
    $\begingroup$ Note that 101112213141516171819 has an odd number of digits since there are 11 ones. $\endgroup$ Jan 18 at 15:56
  • 4
    $\begingroup$ The $191817161514132211110$ is greater, the OEIS you link to has additional restriction you do not mention anywhere (the counted digits appear in increasing order). $\endgroup$
    – Sil
    Jan 18 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.