Mac binaries
[jabaws.git] / website / archive / binaries / mac / src / disembl / Tisean_3.0.1 / source_f / nmore.f
1 c===========================================================================
2 c
3 c   This file is part of TISEAN
4
5 c   Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
6
7 c   TISEAN is free software; you can redistribute it and/or modify
8 c   it under the terms of the GNU General Public License as published by
9 c   the Free Software Foundation; either version 2 of the License, or
10 c   (at your option) any later version.
11 c
12 c   TISEAN is distributed in the hope that it will be useful,
13 c   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 c   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 c   GNU General Public License for more details.
16 c
17 c   You should have received a copy of the GNU General Public License
18 c   along with TISEAN; if not, write to the Free Software
19 c   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 c
21 c===========================================================================
22 c   utilities for TISEAN f-sources
23 c
24       function nmore(n)
25 c find smallest factorisable number .ge.n
26
27       nmore=n
28  1    if(isfact(nmore).eq.1) return
29       nmore=nmore+1
30       goto 1
31       end
32
33       function nless(n)
34 c find largest factorisable number .le.n
35
36       nless=n
37  1    if(isfact(nless).eq.1) return
38       nless=nless-1
39       goto 1
40       end
41
42       function isfact(n)
43 c determine if n is factorisable using the first nprimes primes
44       parameter(nprimes=3)
45       dimension iprime(nprimes)
46       data iprime/2,3,5/
47
48       isfact=1
49       ncur=n
50  1    if(ncur.eq.1) return
51       do 10 i=1,nprimes
52          if(mod(ncur,iprime(i)).eq.0) then
53             ncur=ncur/iprime(i)
54             goto 1
55          endif
56  10      continue
57       isfact=0
58       end