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
What are the three fundamental features of anobject-oriented programming language?
hjlf

Answer:

  1. Inheritance
  2. Data abstraction or Data encapsulation
  3. Polymorphism.

Explanation:

The three fundamental features of an object oriented programming language are written above.

1. Inheritance:It is the mechanism when a class acquires the properties of some other class.The class which acquires the properties is called the child class and the class from which properties are inherited is called the base class.

2. Data encapsulation is clubbing different types of data in one place.That what class does .It can contain different data types in one place and those variables can be public ,private or protected.

3.Polymorphism it the property when an entity is processed in more than one form.Either be it run time or compile time polymorphism .

6 0
3 years ago
Dwayne Alexander is working on a project promoting a fictitious product for his marketing class. He wants to use animation to sh
erastova [34]

The following are examples of animation apps:

  • Toon Boom Animation (2-D)
  • Prisma3D (3-D) and
  • AnimeTok (3-D)

<h3>What are the Pros and the cons of each app listed above?</h3>

Toon Boom Animation Pros:

  • It has a great set of tools
  • It has camera angles functionality
  • Has a vector drawing tool

Cons:

  • It is expensive.

Prisma3D (3-D) Pros:

  • It is good for modeling;
  • Easy to use interface

Cons:

  • It has too many bugs.
  • lacks sculpting tools

AnimeTok (3-D) Pros:

  • It makes it easy to move the characters easily
  • It is easy to understand

Cons:

  • It has too many ads
  • does not have an undo and redo button

Learn more about Animation Apps at:
brainly.com/question/7279789

6 0
2 years ago
Suppose x is 1. What is x after x = 1?<br> A. -1<br> B. 0<br> C. 1<br> D. 2<br> E. -2
Dimas [21]

Answer:

its number 10204921094993293959592828358

Explanation:

also 339399393993939399393

8 0
3 years ago
Brainly keeps deleting my questions and I don’t know why It says I violated the rules but I didn’t. pls help
labwork [276]

Well brainly could be deleting you question because of things like,

  • The question is for an exam
  • The question does not include proper question material
  • A singular swear word
  • Its not subject related to(math, science, history or etc).

<em>Hope this helps!</em>

3 0
2 years ago
Which one is the result of the output given by a computer <br>I​
zvonat [6]

Explanation:

<h2><em><u>Instruction</u></em><em><u> </u></em><em><u>,</u></em><em><u> </u></em><em><u>data</u></em><em><u> </u></em><em><u>and</u></em><em><u> </u></em><em><u>information</u></em><em><u> </u></em><em><u>all</u></em><em><u> </u></em><em><u>of</u></em><em><u> </u></em><em><u>these</u></em><em><u>. </u></em><em><u> </u></em></h2>

8 0
2 years ago
Other questions:
  • #You may modify the lines of code above, but don't move them! #When you Submit your code, we'll change these lines to #assign di
    6·1 answer
  • 10. Question
    15·1 answer
  • The four key stages with regards to data visualization workflow. Select one key stage and explain it briefly about that stage.St
    10·1 answer
  • Which of these devices is usually the default for most home network?
    12·1 answer
  • An IT professional with a customer-service
    13·1 answer
  • (asking again because point-hogs exist)
    11·1 answer
  • Breaking code rules is only a problem once in a while. Group of answer choices True False
    12·1 answer
  • Classify computer based on signal
    14·1 answer
  • Why are wiki's not secure​
    9·1 answer
  • How does your ability to correctly count change affect the impression the customer has of you?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!