问题描述:
解决问题:
public class Problem47 {
public static int[] elements = new int[100000];
public static int find_prime_factors(int number){
int index = 2;
int total = 0;
int tmp = number;
while(number!=1){
if(number%index==0){
total++;
do{
number= number/index;
}while(number%index==0);
total = 1 + elements[number];
number = 1;
}
index++;
}
elements[tmp]=total;
return total;
}
public static int find_first(int times){
int first =0;
int begin = 20;
int total = 0;
do{
total = 0;
if(find_prime_factors(begin)==times){
total++;
for(int i=1;i<times;i++){
if(find_prime_factors(begin+i)!=times){
begin = begin+i+1;
break;
}else{
total++;
}
}
first = begin;
}else{
begin++;
}
}while(total<times);
return first;
}
public static void main(String[] args){
long t1 = System.currentTimeMillis();
System.out.println(find_first(4));
long t2 = System.currentTimeMillis();
System.out.println(t2-t1);
}
}
分享到:
相关推荐
humAn WinDOW criTeriA & rAnkinG Of sOLuTiOns......Page 47 cLAssificATiOn......Page 50 Refs......Page 52 3 Missionaries & Cannibals......Page 53 chOOsinG An APPrOPriATe rePresenTATiOn......Page 55 ...
C#,电话数字键盘问题(Mobile Numeric Keypad problem)的算法与源代码 电话数字键盘问题 提供移动数字键盘。您只能按向上、向左、向右或向下至当前按钮的按钮。不允许您按最下面一行的角点按钮(即.*和#)。 ...
Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions.chm,英文版本,chm 格式,大小 366 Kb,作者:Herb Sutter。 内容简介: Exceptional C++ shows by example how to go about sound ...
从给定的文件信息来看,我们正在探讨的是47届国际数学奥林匹克竞赛的题目与解答,这是一项在2006年于斯洛文尼亚举办的全球性数学竞赛,旨在挑战和展示世界各地中学生的数学才能。以下是对部分问题的详细解析: ### ...
MD5_STEP(II, c, d, a, b, block[10], 0xffeff47d, 15); MD5_STEP(II, b, c, d, a, block[1], 0x85845dd1, 21); MD5_STEP(II, a, b, c, d, block[8], 0x6fa87e4f, 6); MD5_STEP(II, d, a, b, c, block[15], 0xfe...
这些文件主要用于解决两个问题,一个是第一题的程序,另一个是名为"Problem2"的独立任务。从标签中我们提取出了一些关键术语,包括"data.location"、"document.title",这可能与编程中的数据处理和文档交互有关。 ...
47 3.7.2 Queue solution . . . . . . . . . . . . . . . . . . . . . . . . 49 3.7.3 Exclusive queue hint . . . . . . . . . . . . . . . . . . . . . 51 3.7.4 Exclusive queue solution . . . . . . . . . . ....
本文将深入探讨如何使用MATLAB这一强大的计算工具来解决旅行商问题(Traveling Salesman Problem, TSP),并通过应用蚁群算法(Ant Colony Optimization, ACO)即AC0版本进行具体实现。旅行商问题是一个经典的组合...
47-置换-ii.md 第48章 第49章 5个最长回文子串.md 50-powx-n.md 6字形转换.md 7-反向整数.md 9回文数101-150(数量:30) 第101章 第102章 103二叉树之字形水平遍历.md 二叉树最大深度104.md 105从预购和有序...
in this program i am first creating a training data set by applying the angular values to the 2 dof DK model and then supplying the data to the anfis function the function DK47 is the direct ...
Computer Networking: A Top-Down Approach, 6th Edition Solutions to Review Questions and Problems Version Date: May 2012 ...This document contains the solutions to review questions ...Problem 1 There...
1-47 Cluster Data with a Self-Organizing Map . . . . . . 1-56 Defining a Problem . . . . . . . . . . . . . . . . . 1-56 vii Using the Neural Network Clustering Tool ... . . 1-57 Using Command-Line ...
3.2.4 Modifying Lists 47 3.2.5 Copying a List 49 3.3 TUPLES 49 3.3.1 Tuples Are Immutable Lists 49 3.4 COMMON PROPERTIES OF THE SEQUENCES 51 3.5 DICTIONARIES 54 3.5.1 Mapping: Calling Each Value by a ...
4.2.1 The Problem with Simple Multisymbol Messages 117 4.2.2 The Idea of Error Correction Codes 118 4.2.3 Example: Trellis Codes and Viterbi Decoding 119 4.3 Detecting Multisymbol Watermarks 124 ...
非对称旅行商问题(Asymmetric Traveling Salesman Problem, ATSP)是图论中一个经典的组合优化问题,它与我们的日常生活息息相关,如物流配送、路线规划等。在这个问题中,旅行商需要访问n个城市一次,并返回起点,...
47. DwZone ASP Upload And Resize V2.2.2 For Adobe Dreamweaver 48. DwZone ASP Upload Simple V1.7.5 For Adobe Dreamweaver? 49. DwZone ASP Upload V1.9.0 For Adobe Dreamweaver 50. DwZone ASP.NET Advanced ...
47. DwZone ASP Upload And Resize V2.2.2 For Adobe Dreamweaver 48. DwZone ASP Upload Simple V1.7.5 For Adobe Dreamweaver? 49. DwZone ASP Upload V1.9.0 For Adobe Dreamweaver 50. DwZone ASP.NET Advanced ...
47. DwZone ASP Upload And Resize V2.2.2 For Adobe Dreamweaver 48. DwZone ASP Upload Simple V1.7.5 For Adobe Dreamweaver? 49. DwZone ASP Upload V1.9.0 For Adobe Dreamweaver 50. DwZone ASP.NET Advanced ...
47. DwZone ASP Upload And Resize V2.2.2 For Adobe Dreamweaver 48. DwZone ASP Upload Simple V1.7.5 For Adobe Dreamweaver? 49. DwZone ASP Upload V1.9.0 For Adobe Dreamweaver 50. DwZone ASP.NET Advanced ...
47. DwZone ASP Upload And Resize V2.2.2 For Adobe Dreamweaver 48. DwZone ASP Upload Simple V1.7.5 For Adobe Dreamweaver? 49. DwZone ASP Upload V1.9.0 For Adobe Dreamweaver 50. DwZone ASP.NET Advanced ...