Re: find missing numbers in a series
- To: mathgroup at smc.vnet.net
- Subject: [mg119049] Re: find missing numbers in a series
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 20 May 2011 06:40:16 -0400 (EDT)
- References: <ir2vma$h0r$1@smc.vnet.net>
Am 19.05.2011 13:42, schrieb shippee: > I have a series of numbers ranging from PE00001 to PE99999. > Sample/Snippet below (descending order): > PE00445 ... > PE00260 > > What would be the best approach to have mathematica show me what > STRINGS are missing from this series? > > Thanks in advance, > > Steven Shippee > Olympia, Washington > Hi, say, you've got the above strings in a list named data: data = ImportString["PE00445 PE00444 ... PE00261 PE00260"] // Flatten; then In[25]:= StringJoin["PE",#]&/@ToString/@Complement[Range[260,445],ToExpression[StringDrop[#,2]&/@data]] Out[25]= {PE271, PE272, PE274, PE282, PE285, PE286, PE287, PE288, PE289, PE290, PE291, PE292, PE293, PE294, PE295, PE296, PE297, PE298, PE299, PE300, PE301, PE302, PE303, PE304, PE305, PE306, PE307, PE308, PE309, PE310, PE311, PE312, PE313, PE314, PE315, PE316, PE317, PE318, PE319, PE320, PE321, PE322, PE324, PE325, PE327, PE329, PE331, PE333, PE335, PE336, PE337, PE338, PE340, PE341, PE342, PE343, PE345, PE346, PE347, PE349, PE351, PE353, PE354, PE355, PE356, PE357, PE358, PE359, PE360, PE361, PE362, PE363, PE364, PE365, PE366, PE367, PE368, PE369, PE370, PE371, PE372, PE373, PE375, PE376, PE378, PE379, PE380, PE382, PE384, PE385, PE387, PE388, PE389, PE390, PE391, PE392, PE394, PE395, PE396, PE399, PE401, PE402, PE406, PE407, PE408, PE409, PE413, PE415, PE419, PE421, PE422, PE425, PE426, PE427, PE429, PE430, PE431, PE433, PE435, PE436, PE439, PE440, PE441, PE443} gives the desired result. Peter