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

Home > Algorithms
Number of Zero Digits (Posted on 2024-04-07) Difficulty: 3 of 5
Derive an algorithm to calculate the total number of zeros in the decimal expansion of 20242024.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
No Subject Comment 3 of 3 |
clc
a=sym(2024)^2024
b=char(a)
sum(b=='0')
length(b)
 
for n=[1:100 2000:2050]
  a=sym(n)^n;
  b=char(a);
  s=sum(b=='0');
  l=length(b);
  fprintf('%5d %5d %5d %16.12f\n',[n s l s/l])
end

ans =
   705           zeros
ans =
         6692    digits total
         
         
Some more numbers:         
         
    #   zeros digits    fraction     
    1     0     1   0.000000000000
    2     0     1   0.000000000000
    3     0     2   0.000000000000
    4     0     3   0.000000000000
    5     0     4   0.000000000000
    6     0     5   0.000000000000
    7     0     6   0.000000000000
    8     0     8   0.000000000000
    9     1     9   0.111111111111
   10    10    11   0.909090909091
   11     1    12   0.083333333333
   12     2    13   0.153846153846
   13     2    15   0.133333333333
   14     3    17   0.176470588235
   15     2    18   0.111111111111
   16     2    20   0.100000000000
   17     1    21   0.047619047619
   18     2    23   0.086956521739
   19     1    25   0.040000000000
   20    21    27   0.777777777778
   21     1    28   0.035714285714
   22     0    30   0.000000000000
   23     5    32   0.156250000000
   24     2    34   0.058823529412
   25     3    35   0.085714285714
   26     6    37   0.162162162162
   27     3    39   0.076923076923
   28     1    41   0.024390243902
   29     1    43   0.023255813953
   30    32    45   0.711111111111
   31     6    47   0.127659574468
   32     5    49   0.102040816327
   33     7    51   0.137254901961
   34     7    53   0.132075471698
   35     3    55   0.054545454545
   36     3    57   0.052631578947
   37     6    59   0.101694915254
   38     8    61   0.131147540984
   39     6    63   0.095238095238
   40    42    65   0.646153846154
   41     5    67   0.074626865672
   42     6    69   0.086956521739
   43    10    71   0.140845070423
   44    10    73   0.136986301370
   45     5    75   0.066666666667
   46    11    77   0.142857142857
   47     4    79   0.050632911392
   48    12    81   0.148148148148
   49    11    83   0.132530120482
   50    53    85   0.623529411765
   51     5    88   0.056818181818
   52     6    90   0.066666666667
   53    12    92   0.130434782609
   54    10    94   0.106382978723
   55     8    96   0.083333333333
   56    11    98   0.112244897959
   57    15   101   0.148514851485
   58     9   103   0.087378640777
   59     5   105   0.047619047619
   60    64   107   0.598130841121
   61    12   109   0.110091743119
   62    15   112   0.133928571429
   63    14   114   0.122807017544
   64    16   116   0.137931034483
   65    13   118   0.110169491525
   66    12   121   0.099173553719
   67    13   123   0.105691056911
   68     9   125   0.072000000000
   69    16   127   0.125984251969
   70    79   130   0.607692307692
   71    12   132   0.090909090909
   72    16   134   0.119402985075
   73    15   137   0.109489051095
   74    12   139   0.086330935252
   75    14   141   0.099290780142
   76    15   143   0.104895104895
   77    13   146   0.089041095890
   78    18   148   0.121621621622
   79    11   150   0.073333333333
   80    85   153   0.555555555556
   81    18   155   0.116129032258
   82    11   157   0.070063694268
   83    17   160   0.106250000000
   84    13   162   0.080246913580
   85    20   165   0.121212121212
   86    20   167   0.119760479042
   87    15   169   0.088757396450
   88    16   172   0.093023255814
   89    18   174   0.103448275862
   90   101   176   0.573863636364
   91    16   179   0.089385474860
   92    22   181   0.121546961326
   93    22   184   0.119565217391
   94    16   186   0.086021505376
   95    15   188   0.079787234043
   96     9   191   0.047120418848
   97    18   193   0.093264248705
   98    28   196   0.142857142857
   99    20   198   0.101010101010
  100   200   201   0.995024875622
  
  
 2000  6062  6603   0.918067545055
 2001   707  6606   0.107023917651
 2002   667  6610   0.100907715582
 2003   656  6614   0.099183550045
 2004   635  6618   0.095950438199
 2005   643  6621   0.097115239390
 2006   722  6625   0.108981132075
 2007   667  6629   0.100618494494
 2008   643  6632   0.096954161641
 2009   643  6636   0.096895720313
 2010  2479  6640   0.373343373494
 2011   653  6644   0.098284166165
 2012   685  6647   0.103054009328
 2013   679  6651   0.102089911292
 2014   671  6655   0.100826446281
 2015   695  6659   0.104370025529
 2016   651  6662   0.097718402882
 2017   677  6666   0.101560156016
 2018   660  6670   0.098950524738
 2019   652  6674   0.097692538208
 2020  2515  6677   0.376666167440
 2021   661  6681   0.098937284838
 2022   676  6685   0.101121914734
 2023   686  6689   0.102556435940
 2024   705  6692   0.105349671249
 2025   652  6696   0.097371565114
 2026   672  6700   0.100298507463
 2027   648  6703   0.096673131434
 2028   663  6707   0.098851945728
 2029   668  6711   0.099538071822
 2030  2517  6715   0.374832464631
 2031   641  6718   0.095415302173
 2032   678  6722   0.100862838441
 2033   644  6726   0.095747844187
 2034   657  6730   0.097622585438
 2035   669  6733   0.099361354523
 2036   635  6737   0.094255603384
 2037   625  6741   0.092716214212
 2038   677  6745   0.100370644922
 2039   666  6748   0.098695909899
 2040  2552  6752   0.377962085308
 2041   669  6756   0.099023090586
 2042   654  6760   0.096745562130
 2043   682  6763   0.100842821233
 2044   658  6767   0.097236589331
 2045   729  6771   0.107665042091
 2046   662  6775   0.097712177122
 2047   699  6778   0.103127766303
 2048   690  6782   0.101739899735
 2049   676  6786   0.099616858238
 2050  2563  6790   0.377466863034

  Posted by Charlie on 2024-04-07 15:05:19
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (12)
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