计算机与现代化

• 算法设计与分析 • 上一篇    下一篇

高位水仙花数快速求解算法

  

  1. (四川文理学院计算机学院,四川达州635000)
  • 收稿日期:2015-02-04 出版日期:2015-06-16 发布日期:2015-06-18
  • 作者简介:卫洪春(1972-),男,四川达县人,四川文理学院计算机学院讲师,硕士,研究方向:软件工程,数字媒体技术。
  • 基金资助:
    国家自然科学基金资助项目(61152003); 四川省教育厅项目(152B0326);四川文理学院智能物流创新团队资助项目

Fast Algorithm of Large Narcissus Number

  1. (Computer Science Department of Sichuan University of Arts and Science, Dazhou 635000, China)
  • Received:2015-02-04 Online:2015-06-16 Published:2015-06-18

摘要: 为了处理超出计算机字长范围的整数,需要构造合适的数据结构,用以存储超大数据。本文研究水仙花数的特征,结合排列组合和函数单调性等相关理论,借助“栈”后进先出的特点,利用动态数组存储超大整数。这种方法突破了传统设计思路仅考虑有限长度范围内的整型数据处理的约束,使得寻找正整数范围内的水仙花数的计算工作量呈几何级减少,达到了在较短时间内快速寻找正整数集合内所有水仙花数的目的,对超大整数的处理具有较好的参考作用。

关键词: 水仙花数, 栈, 存储, 动态数组, 字长

Abstract: In order to process those integers beyond the scope of computer wordlength, we need to construct suitable data structures for storing big data. This paper studies the characteristics of Narcissus numbers; combines the theory of permutation and combination with functional monotonicity; uses stack which has LIFO character; stores large integer by dynamic array. This method breaks through the traditional design which only considers processing finite length integers, makes the calculation work of finding Narcissus numbers reduce exponentially in the range of positive integers, achieves the purpose of finding all Narcissus numbers quickly in a short period of time within the set of positive integers. This method is a good reference for the processing of large integer.

Key words: Narcissus number, stack, memory, dynamic array, wordlength

中图分类号: