SlideShare uma empresa Scribd logo
1 de 2
Return whether the number is semiprime.
public static boolean isPQ(long.number) {
return true;
}
Solution
This is what i have any queries please comment
public static boolean isPQ(long number)
{
if (number == || number == || number == )
{
return true;
}
int increase = 1;
if (!((int)number % 2 == 0))
{
increase = 2;
}
ArrayList<Integer> factors = new ArrayList<Integer>();
for (int i = 1; i <= (int)number/2; i = i + increase)
{
if ((int)number % i == 0)
{
factors.add(i);
}
factors.add((int)number);
}
if (!(factors.size() == 4))
{
return false;
}
for (int i2 = 0; i2 < factors.size() - 1; i2++)
{
int factor = factors.get(i2);
if (!(isPrime(factor)))
{
return false;
}
}
return true;
}

Mais conteúdo relacionado

Mais de rtodd15

Select one of the six criteria air pollutants and describe how you wou.docx
Select one of the six criteria air pollutants and describe how you wou.docxSelect one of the six criteria air pollutants and describe how you wou.docx
Select one of the six criteria air pollutants and describe how you wou.docxrtodd15
 
Select a Health Informatics related article from a mainstream news sou.docx
Select a Health Informatics related article from a mainstream news sou.docxSelect a Health Informatics related article from a mainstream news sou.docx
Select a Health Informatics related article from a mainstream news sou.docxrtodd15
 
Samuel has been asked to start the implementation of IPv6 on an existi.docx
Samuel has been asked to start the implementation of IPv6 on an existi.docxSamuel has been asked to start the implementation of IPv6 on an existi.docx
Samuel has been asked to start the implementation of IPv6 on an existi.docxrtodd15
 
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docx
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docxSearching a Binary Tree in C Write a C function that accepts a pointer (1).docx
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docxrtodd15
 
SAT Chemistry question- The best way to seperate potassium iodide from.docx
SAT Chemistry question- The best way to seperate potassium iodide from.docxSAT Chemistry question- The best way to seperate potassium iodide from.docx
SAT Chemistry question- The best way to seperate potassium iodide from.docxrtodd15
 
Review Topics) -References Use the References to access important valu.docx
Review Topics) -References Use the References to access important valu.docxReview Topics) -References Use the References to access important valu.docx
Review Topics) -References Use the References to access important valu.docxrtodd15
 
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docx
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docxSan Mateo Healthcare had an equity balance of $1-50 million at the beg.docx
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docxrtodd15
 
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docx
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docxS12-2 (Learning Objective 1- Explain the purposes of the statement of.docx
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docxrtodd15
 
S10-16 (Learning Objective 5- Compute and explain return on assets and.docx
S10-16 (Learning Objective 5- Compute and explain return on assets and.docxS10-16 (Learning Objective 5- Compute and explain return on assets and.docx
S10-16 (Learning Objective 5- Compute and explain return on assets and.docxrtodd15
 
Salem Corporation is considering implementing a 401k program for its e.docx
Salem Corporation is considering implementing a 401k program for its e.docxSalem Corporation is considering implementing a 401k program for its e.docx
Salem Corporation is considering implementing a 401k program for its e.docxrtodd15
 
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docx
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docxS Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docx
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docxrtodd15
 
Roy and Monica are married and will file a joint return- They have a d.docx
Roy and Monica are married and will file a joint return- They have a d.docxRoy and Monica are married and will file a joint return- They have a d.docx
Roy and Monica are married and will file a joint return- They have a d.docxrtodd15
 

Mais de rtodd15 (12)

Select one of the six criteria air pollutants and describe how you wou.docx
Select one of the six criteria air pollutants and describe how you wou.docxSelect one of the six criteria air pollutants and describe how you wou.docx
Select one of the six criteria air pollutants and describe how you wou.docx
 
Select a Health Informatics related article from a mainstream news sou.docx
Select a Health Informatics related article from a mainstream news sou.docxSelect a Health Informatics related article from a mainstream news sou.docx
Select a Health Informatics related article from a mainstream news sou.docx
 
Samuel has been asked to start the implementation of IPv6 on an existi.docx
Samuel has been asked to start the implementation of IPv6 on an existi.docxSamuel has been asked to start the implementation of IPv6 on an existi.docx
Samuel has been asked to start the implementation of IPv6 on an existi.docx
 
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docx
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docxSearching a Binary Tree in C Write a C function that accepts a pointer (1).docx
Searching a Binary Tree in C Write a C function that accepts a pointer (1).docx
 
SAT Chemistry question- The best way to seperate potassium iodide from.docx
SAT Chemistry question- The best way to seperate potassium iodide from.docxSAT Chemistry question- The best way to seperate potassium iodide from.docx
SAT Chemistry question- The best way to seperate potassium iodide from.docx
 
Review Topics) -References Use the References to access important valu.docx
Review Topics) -References Use the References to access important valu.docxReview Topics) -References Use the References to access important valu.docx
Review Topics) -References Use the References to access important valu.docx
 
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docx
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docxSan Mateo Healthcare had an equity balance of $1-50 million at the beg.docx
San Mateo Healthcare had an equity balance of $1-50 million at the beg.docx
 
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docx
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docxS12-2 (Learning Objective 1- Explain the purposes of the statement of.docx
S12-2 (Learning Objective 1- Explain the purposes of the statement of.docx
 
S10-16 (Learning Objective 5- Compute and explain return on assets and.docx
S10-16 (Learning Objective 5- Compute and explain return on assets and.docxS10-16 (Learning Objective 5- Compute and explain return on assets and.docx
S10-16 (Learning Objective 5- Compute and explain return on assets and.docx
 
Salem Corporation is considering implementing a 401k program for its e.docx
Salem Corporation is considering implementing a 401k program for its e.docxSalem Corporation is considering implementing a 401k program for its e.docx
Salem Corporation is considering implementing a 401k program for its e.docx
 
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docx
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docxS Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docx
S Wh Cmput listest bekow has the greatest molar solutiliy in water- 4).docx
 
Roy and Monica are married and will file a joint return- They have a d.docx
Roy and Monica are married and will file a joint return- They have a d.docxRoy and Monica are married and will file a joint return- They have a d.docx
Roy and Monica are married and will file a joint return- They have a d.docx
 

Último

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Último (20)

Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

Return whether the number is semiprime- public static boolean isPQ(lon.docx

  • 1. Return whether the number is semiprime. public static boolean isPQ(long.number) { return true; } Solution This is what i have any queries please comment public static boolean isPQ(long number) { if (number == || number == || number == ) { return true; } int increase = 1; if (!((int)number % 2 == 0)) { increase = 2; } ArrayList<Integer> factors = new ArrayList<Integer>(); for (int i = 1; i <= (int)number/2; i = i + increase) { if ((int)number % i == 0) { factors.add(i); } factors.add((int)number); } if (!(factors.size() == 4)) { return false; }
  • 2. for (int i2 = 0; i2 < factors.size() - 1; i2++) { int factor = factors.get(i2); if (!(isPrime(factor))) { return false; } } return true; }