All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Digitally Average Integers (Posted on 2019-08-14) Difficulty: 3 of 5
We will say that an integer is digitally average if the average of its (decimal) digits is 4.5 (the average of the digits from 0 to 9). How many 10-digit integers are digitally average?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |
There are 392,406,145 digitally average integers according to the program below, and the first 250 of them are:

1000089999
1000098999
1000099899
1000099989
1000099998
1000179999
1000188999
1000189899
1000189989
1000189998
1000197999
1000198899
1000198989
1000198998
1000199799
1000199889
1000199898
1000199979
1000199988
1000199997
1000269999
1000278999
1000279899
1000279989
1000279998
1000287999
1000288899
1000288989
1000288998
1000289799
1000289889
1000289898
1000289979
1000289988
1000289997
1000296999
1000297899
1000297989
1000297998
1000298799
1000298889
1000298898
1000298979
1000298988
1000298997
1000299699
1000299789
1000299798
1000299879
1000299888
1000299897
1000299969
1000299978
1000299987
1000299996
1000359999
1000368999
1000369899
1000369989
1000369998
1000377999
1000378899
1000378989
1000378998
1000379799
1000379889
1000379898
1000379979
1000379988
1000379997
1000386999
1000387899
1000387989
1000387998
1000388799
1000388889
1000388898
1000388979
1000388988
1000388997
1000389699
1000389789
1000389798
1000389879
1000389888
1000389897
1000389969
1000389978
1000389987
1000389996
1000395999
1000396899
1000396989
1000396998
1000397799
1000397889
1000397898
1000397979
1000397988
1000397997
1000398699
1000398789
1000398798
1000398879
1000398888
1000398897
1000398969
1000398978
1000398987
1000398996
1000399599
1000399689
1000399698
1000399779
1000399788
1000399797
1000399869
1000399878
1000399887
1000399896
1000399959
1000399968
1000399977
1000399986
1000399995
1000449999
1000458999
1000459899
1000459989
1000459998
1000467999
1000468899
1000468989
1000468998
1000469799
1000469889
1000469898
1000469979
1000469988
1000469997
1000476999
1000477899
1000477989
1000477998
1000478799
1000478889
1000478898
1000478979
1000478988
1000478997
1000479699
1000479789
1000479798
1000479879
1000479888
1000479897
1000479969
1000479978
1000479987
1000479996
1000485999
1000486899
1000486989
1000486998
1000487799
1000487889
1000487898
1000487979
1000487988
1000487997
1000488699
1000488789
1000488798
1000488879
1000488888
1000488897
1000488969
1000488978
1000488987
1000488996
1000489599
1000489689
1000489698
1000489779
1000489788
1000489797
1000489869
1000489878
1000489887
1000489896
1000489959
1000489968
1000489977
1000489986
1000489995
1000494999
1000495899
1000495989
1000495998
1000496799
1000496889
1000496898
1000496979
1000496988
1000496997
1000497699
1000497789
1000497798
1000497879
1000497888
1000497897
1000497969
1000497978
1000497987
1000497996
1000498599
1000498689
1000498698
1000498779
1000498788
1000498797
1000498869
1000498878
1000498887
1000498896
1000498959
1000498968
1000498977
1000498986
1000498995
1000499499
1000499589
1000499598
1000499679
1000499688
1000499697
1000499769
1000499778
1000499787
1000499796
1000499859
1000499868
1000499877
1000499886
1000499895
1000499949
1000499958
1000499967
1000499976
1000499985

DefDbl A-Z
Dim crlf$, dig(10), ct, remain, sz

Private Sub Form_Load()
 Text1.Text = ""
 crlf$ = Chr(13) + Chr(10)
 Form1.Visible = True
 
  remain = 45: sz = 10
  addon 1
   
  Text1.Text = Text1.Text & ct & " done"
  DoEvents

End Sub

Sub addon(wh)
  DoEvents
  If wh = 1 Then st = 1 Else st = 0
  For v = st To 9
    If v > remain Then Exit For
    remain = remain - v
    
    dig(wh) = v
    If wh = sz - 1 And remain < 10 Then
      ct = ct + 1 'remain goes into the last digit
      dig(wh + 1) = remain
      If ct <= 250 Then
        For i = 1 To 10
          Text1.Text = Text1.Text & dig(i)
        Next
        Text1.Text = Text1.Text & crlf
      End If
    Else
      If wh < sz - 1 And 9 * (sz - wh) >= remain Then addon wh + 1
    End If
    
    remain = remain + v
  Next
End Sub


  Posted by Charlie on 2019-08-14 09:41:12
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (17)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information