summaryrefslogtreecommitdiff
path: root/ipl/procs/verncnt.icn
blob: e759175bae8157ccc7b17f7018d6919069da2e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
############################################################################
#
#	File:     verncnt.icn
#
#	Subject:  Procedure to compute number of n-digit versum numbers
#
#	Author:   Ralph E. Griswold
#
#	Date:     January 2, 1998
#
############################################################################
#
#  This file is in the public domain.
#
############################################################################
#
#  This procedure produces an approximation to the number of n-digit
#  versum numbers, using a recurrence described in "Versum Numbers" in
#  Icon Analyst 35.
#
############################################################################

procedure verncnt(n)		#: number of n-digit versum numbers

   return case integer(n) of {
      1       :        4
      2       :       14
      3       :       93
      4       :      256
      5       :     1793
      6       :     4872
      7       :    34107
      8       :    92590
      9       :   648154
      10      :  1759313
      default :  19 * verncnt(n - 2)
      }

end