100,403 research outputs found

    Efficient long division via Montgomery multiply

    Full text link
    We present a novel right-to-left long division algorithm based on the Montgomery modular multiply, consisting of separate highly efficient loops with simply carry structure for computing first the remainder (x mod q) and then the quotient floor(x/q). These loops are ideally suited for the case where x occupies many more machine words than the divide modulus q, and are strictly linear time in the "bitsize ratio" lg(x)/lg(q). For the paradigmatic performance test of multiword dividend and single 64-bit-word divisor, exploitation of the inherent data-parallelism of the algorithm effectively mitigates the long latency of hardware integer MUL operations, as a result of which we are able to achieve respective costs for remainder-only and full-DIV (remainder and quotient) of 6 and 12.5 cycles per dividend word on the Intel Core 2 implementation of the x86_64 architecture, in single-threaded execution mode. We further describe a simple "bit-doubling modular inversion" scheme, which allows the entire iterative computation of the mod-inverse required by the Montgomery multiply at arbitrarily large precision to be performed with cost less than that of a single Newtonian iteration performed at the full precision of the final result. We also show how the Montgomery-multiply-based powering can be efficiently used in Mersenne and Fermat-number trial factorization via direct computation of a modular inverse power of 2, without any need for explicit radix-mod scalings.Comment: 23 pages; 8 tables v2: Tweak formatting, pagecount -= 2. v3: Fix incorrect powers of R in formulae [7] and [11] v4: Add Eldridge & Walter ref. v5: Clarify relation between Algos A/A',D and Hensel-div; clarify true-quotient mechanics; Add Haswell timings, refs to Agner Fog timings pdf and GMP asm-timings ref-page. v6: Remove stray +bw in MULL line of Algo D listing; add note re byte-LUT for qinv_

    An Analysis of Arithmetic Constraints on Integer Intervals

    Get PDF
    Arithmetic constraints on integer intervals are supported in many constraint programming systems. We study here a number of approaches to implement constraint propagation for these constraints. To describe them we introduce integer interval arithmetic. Each approach is explained using appropriate proof rules that reduce the variable domains. We compare these approaches using a set of benchmarks. For the most promising approach we provide results that characterize the effect of constraint propagation. This is a full version of our earlier paper, cs.PL/0403016.Comment: 44 pages, to appear in 'Constraints' journa

    Algorithmic counting of nonequivalent compact Huffman codes

    Full text link
    It is known that the following five counting problems lead to the same integer sequence~ft(n)f_t(n): the number of nonequivalent compact Huffman codes of length~nn over an alphabet of tt letters, the number of `nonequivalent' canonical rooted tt-ary trees (level-greedy trees) with nn~leaves, the number of `proper' words, the number of bounded degree sequences, and the number of ways of writing 1=1tx1+⋯+1txn1= \frac{1}{t^{x_1}}+ \dots + \frac{1}{t^{x_n}} with integers 0≤x1≤x2≤⋯≤xn0 \leq x_1 \leq x_2 \leq \dots \leq x_n. In this work, we show that one can compute this sequence for \textbf{all} n<Nn<N with essentially one power series division. In total we need at most N1+εN^{1+\varepsilon} additions and multiplications of integers of cNcN bits, c<1c<1, or N2+εN^{2+\varepsilon} bit operations, respectively. This improves an earlier bound by Even and Lempel who needed O(N3)O(N^3) operations in the integer ring or O(N4)O(N^4) bit operations, respectively

    Prime power terms in elliptic divisibility sequences

    Full text link
    We consider a particular case of an analog for elliptic curves to the Mersenne problem : finding explicitely all prime power terms in an elliptic divisibility sequence when descent via isogeny is possible. We explain how this question can be related to classical problems in diophantine geometry and we compute an explicit upper bound on the index of prime power terms in magnified elliptic divisibility sequences.Comment: 30 pages, submitte

    Root finding with threshold circuits

    Get PDF
    We show that for any constant d, complex roots of degree d univariate rational (or Gaussian rational) polynomials---given by a list of coefficients in binary---can be computed to a given accuracy by a uniform TC^0 algorithm (a uniform family of constant-depth polynomial-size threshold circuits). The basic idea is to compute the inverse function of the polynomial by a power series. We also discuss an application to the theory VTC^0 of bounded arithmetic.Comment: 19 pages, 1 figur

    Number theoretic example of scale-free topology inducing self-organized criticality

    Full text link
    In this work we present a general mechanism by which simple dynamics running on networks become self-organized critical for scale free topologies. We illustrate this mechanism with a simple arithmetic model of division between integers, the division model. This is the simplest self-organized critical model advanced so far, and in this sense it may help to elucidate the mechanism of self-organization to criticality. Its simplicity allows analytical tractability, characterizing several scaling relations. Furthermore, its mathematical nature brings about interesting connections between statistical physics and number theoretical concepts. We show how this model can be understood as a self-organized stochastic process embedded on a network, where the onset of criticality is induced by the topology.Comment: 4 pages, 3 figures. Physical Review Letters, in pres

    Computing with and without arbitrary large numbers

    Full text link
    In the study of random access machines (RAMs) it has been shown that the availability of an extra input integer, having no special properties other than being sufficiently large, is enough to reduce the computational complexity of some problems. However, this has only been shown so far for specific problems. We provide a characterization of the power of such extra inputs for general problems. To do so, we first correct a classical result by Simon and Szegedy (1992) as well as one by Simon (1981). In the former we show mistakes in the proof and correct these by an entirely new construction, with no great change to the results. In the latter, the original proof direction stands with only minor modifications, but the new results are far stronger than those of Simon (1981). In both cases, the new constructions provide the theoretical tools required to characterize the power of arbitrary large numbers.Comment: 12 pages (main text) + 30 pages (appendices), 1 figure. Extended abstract. The full paper was presented at TAMC 2013. (Reference given is for the paper version, as it appears in the proceedings.

    Generalized Ehrhart polynomials

    Full text link
    Let PP be a polytope with rational vertices. A classical theorem of Ehrhart states that the number of lattice points in the dilations P(n)=nPP(n) = nP is a quasi-polynomial in nn. We generalize this theorem by allowing the vertices of P(n) to be arbitrary rational functions in nn. In this case we prove that the number of lattice points in P(n) is a quasi-polynomial for nn sufficiently large. Our work was motivated by a conjecture of Ehrhart on the number of solutions to parametrized linear Diophantine equations whose coefficients are polynomials in nn, and we explain how these two problems are related.Comment: 18 pages, no figures; v2: Sections 4 and 5 added, proofs and exposition have been expanded and clarifie
    • …
    corecore