1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
slavikrds [6]
3 years ago
5

circular_prime A number is called a circular prime if all rotations of its digits form a prime. For example, the number 197 is a

circular prime because all possible rotations of its digits: (197, 971, 719) are prime numbers. Write a program that reads in an integer 1 en 10^5 as input and prints True if n is a circular prime and False otherwise.
Computers and Technology
1 answer:
Lilit [14]3 years ago
3 0

Answer:

function out=circular_primes(no)

prim=primes(no);% find the all prime number till the given number

pr=0;

nos=[];

po=[];

for p=1:length(prim)

   n=prim(p); % picking up each prime no one by one

   n=num2str(n);% change into string for rotation of no

   d=length(n); % length of string

   if d>1          % take nos greater than 10 beacuase below 10 no need for rotation

       for h=1:d

           a=n(1);

           for r=1:d % for rotation right to left

               if r==d  5 % for the last element of string

                   n(d)=a;

               else

               n(r)=n(r+1); %shifting

               end

           end

           

       s=str2num(n); % string to number

       nos=[nos,s]; % store rotated elements in array

       end

       if nos(end)==no   %if given no is also a circular prime we need smaller

           break;

       end

       for gr=1:length(nos) % checking rotated nos are prime or not

           p1=isprime(nos(gr));

           po=[po,p1];    %storing logical result in array

       end

           if sum(po(:))==length(nos) %if all are prime the length and sum are must be equal

               

               pr=pr+1;

               out=pr;

           else

               out=pr;

           end

       po=[];

       nos=[];

   else  

       s=str2num(n); %numbers less than 10

       f=isprime(s);

       if f==1

           pr=pr+1;

           out=pr;

       else

           out=pr;

       end

   end

       

      end

end

Explanation:

You might be interested in
Dell, previously the world’s number one PC manufacturer, has seen its market share shrink because of rivals copying its value ch
stepladder [879]

Answer:

A) underscore the importance of continually assessing a firm's strategic position among changing market conditions.

Explanation:

Dell computers believed their leadership position would last forever and forgot the basic rule that it is very hard to reach the top, but it's even harder to stay there.

The market conditions changed since globalization made the world smaller, increasing the potential customers but also increasing competition. Dell wasn't able to revise their strategic position and adapt it to changing markets. A company's strategic position refers to how its strategy deals with changing:

  • environments,
  • competition,
  • resources,
  • stakeholders' expectations.

The same thing happened to General Motors, that once used to be the largest and most profitable car manufacturer in the world, and then went bankrupt. It is still under a lot of financial stress and is continuously losing market share in the US and around the world.

5 0
4 years ago
An object's state is defined by the object's
Eva8 [605]

Answer:

The right answer is option 2: instance variables and their values

Explanation:

Let us define what an object is.

An object is a blueprint of a real-world identity. The instances are the reference to the object. Multiple instances of an object type can be made.

The instance variables and their values help us to determine the state of the object.

Hence,

The right answer is option 2: instance variables and their values

6 0
3 years ago
Which statement best describes antivirus software?
valentina_108 [34]
It identifies and removes viruses in computers
7 0
4 years ago
Did y’all enjoyed project next phase 3 and The 4 revamped heroes
ryzh [129]

Answer:

it was good i liked it

Explanation very good

4 0
3 years ago
Can you please help me? I give you a brainlest <br>! ​
nlexa [21]
1.
2.satin stitch
3.lazy daisy stitch (detached chain )
4.chain stitch
5. cross stitch
6. french knot
7.
8.split stitch
9.
10. back stitch
the others i can’t tell.
4 0
3 years ago
Other questions:
  • PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
    6·1 answer
  • Which of the following represents the TCP/IP four-layer reference model? Group of answer choices Application, Internet, transpor
    11·1 answer
  • To display the entire entry for a calculated field, select the column in the Field row, right-click to display the shortcut menu
    15·1 answer
  • Pressing the Backspace key deletes the text to the of the insertion point. The left or the right?
    8·2 answers
  • 9. DIMMs used in servers can provide additional reliability if they use what specific technology.
    8·1 answer
  • How many characters should a strong password have? four six eight ten
    10·2 answers
  • Someone wanna be in a meeting with me <br><br><br> Code: rrx-ofrw-ocj
    5·2 answers
  • What will happen when you run this program?
    12·2 answers
  • Anyone help me please​
    6·2 answers
  • What is the following file format called? inv_nbr, inv_name, inv_cost 876521,battery,45.00
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!