Help pls. Find the first 10 consecutive numbers after the decimal point in e and pi which sum is the prime number

Find the first 10 consecutive numbers after the decimal point in e and pi which sum is the prime number
isprime() checks if number is prime

3 Commenti

Yes. Homework. What have you done and where are you stuck?
@Matt J idk how to count the sum of digits after decimal
Here is some help. Floating point is only good to about 15 digits. Use symbolic if you need pi to more digits.
a=movsum(num2str(floor((pi-3)*10^14))-'0',10,'Endpoints','discard')
a = 1×5
41 48 53 59 63
isprime(a)
ans = 1×5 logical array
1 0 1 1 0

Risposte (0)

Questa domanda è chiusa.

Tag

Richiesto:

il 13 Ott 2022

Chiuso:

il 13 Ott 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by