Find all the values between 1 to the 5th power of 1 and 100 to the 5th power pascal

Updated on healthy 2024-08-15
13 answers
  1. Anonymous users2024-02-16

    100 to the power of 5 longint can not be represented, can be used with int64 or qwordint64:-9223372036854775808.9223372036854775807

    qword:0..184467440703709551615 )。

    I don't know what you mean, if you want to print all the numbers in between, the array can't be saved, you can only print it directly (it is recommended to set the buffer larger), it takes a long time, and the total file size is at least (8 bytes * 100 to the 5th power 1000 1000 1000 = 80g).

    No kidding upstairs, the computing power is definitely fine, but the output takes up time.

    If you want to sum it, use Gaussian summation formula, which is very simple and not much to say.

  2. Anonymous users2024-02-15

    What do you mean? Sum, or output all integers?

    It's unlikely that it would be ...... if it were all outputPascal is the language of instruction, not so strong in arithmetic.

    If you have to do it, why not use a for statement?

  3. Anonymous users2024-02-14

    Thanks upstairs for the reminder!

    I didn't work with the trunc and round statements (beyond the range of long integers) and forgot to give it a try with the most basic ......

    var a,b,c,d,o:real;

    beginc:=1;

    a:=1;repeat

    a:=a+1;

    d:=c;b:=1;

    o:=d;repeat

    d:=d*o;

    b:=b+1;

    until b=5;

    writeln(d:0:0);readln;

    c:=c+1;

    until a=100;

    readln;

    end.

  4. Anonymous users2024-02-13

    Upstairs changed to writeln (d:0:0) is not lacking.

  5. Anonymous users2024-02-12

    10(10) How do you express that?

    It can only be expressed in double + scientific notation.

  6. Anonymous users2024-02-11

    There are many methods, list 3 kinds below, a for loop to do, a while loop to do, and a repeat loop to do, because the title requires a multiple of 5 or 7, then I will write it as a multiple of 5, and after the landlord himself changes 5 to 7, ** as follows:

    1 for loop.

    vari,ans:longint;

    beginans:=0;

    for i:=1 to 100 do

    if i mod 5=0 then ans:=ans+i;

    writeln(ans);

    end.2 while loops.

    vari,ans:longint;

    begini:=0;ans:=0;

    while i<=100 do begini:=i+5;

    ans:=ans+i;

    end;writeln(ans);

    end.3 repeat loop.

    vari,ans:longint;

    begini:=5;ans:=0;

    repeat

    ans:=ans+i;

    i:=i+5;

    until i>100;

    writeln(ans);

    end.

  7. Anonymous users2024-02-10

    var i,s:longint;

    beginfor i:=1 to 100 doif (i mod 5=0)or(i mod 7=0) then s:=s+i;

    writeln(s);

    end.Standard program,The output is a multiple of 5 in 1-100,And a multiple of 7,If you still don't understand or I don't pay attention to the details,Come to me in a private chat.,I'm very willing to answer.。

  8. Anonymous users2024-02-09

    The sieve method can be used to find the prime number, and the procedure is:

    program zhishu;

    constm = 2;

    n = 100;

    vara:array[m..n] of integer;

    b: array[1..200] of integer;

    k, i, j: integer;

    beginfor i:=m to n do

    a[i] := 1;

    k := 1;

    for i:=m to n do beginif a[i] = 1 then beginj := i + i;

    b[k] := i;

    k := k + 1;

    while j <= n do begina[j] := 0;

    j := j + i;

    end;end;

    end;for i:=1 to n do

    if b[i] <0 then write(b[i], ' ');

    readln;

    end.

  9. Anonymous users2024-02-08

    The sieve method is a method of finding all prime numbers that do not exceed the natural number n(n 1). It is said to have been invented by Eratosthenes (c. 274 194 BC) in ancient Greece, also known as Eratosthenes sieve.

    The specific method is: first arrange the n natural numbers in order. 1 is not a prime number, nor is it a composite number, it should be crossed out.

    The second number 2 is left over as a prime number, and all numbers after 2 that are divisible by 2 are crossed out. The first number after 2 that is not crossed out is 3, leave 3, and cross out all the numbers after 3 that are divisible by 3. The first uncrossed number after 3 is 5, leave 5 behind, and cross out all numbers after 5 that are divisible by 5.

    If you continue to do this, you will filter out all the composite numbers that do not exceed n, leaving all the prime numbers that do not exceed n. Because the Greeks wrote the numbers on the waxed board, each time they crossed out a number, they wrote small dots on it, and after the work of finding prime numbers was completed, these many dots were like a sieve, so they called Eratosthenes' method "Eratosthenes sieve", referred to as "sieve method". (Another explanation is that the numbers were written on papyrus, and each time a number was crossed, the number was dug out, and when the search for prime numbers was done, the many small holes were like a sieve.)

    For example, use the sieve method to find all prime numbers up to 30:

    There are 10 prime numbers 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 that do not exceed 30.

    Procedure: const n=100;

    var a:array[2..n] of boolean;

    i,j:longint;

    beginfillchar(a,sizeof(a),true);

    for i:=2 to n do

    if a[i] then

    beginfor j:=2 to n div i do

    a[j*i]:=false;

    end;for i:=2 to n do if a[i] then writeln(i);

    end.

  10. Anonymous users2024-02-07

    <1> Remove 1 first.

    2> Remove the multiple of 2.

    3> Remove multiples of 3. …

    Remove the multiple of i. …

    All the way up to the root number A.

    ** As follows: vara:array[1..300] of integer;

    i,j,k:integer;

    beginfor i:=2 to 100 do a[i]:=i;

    for i:=2 to sqrt(100) doif a[i]<>0 then (improve efficiency)begin

    j:=1;repeat

    j:=j+1;

    k:=i*j;

    a[k]:=0;

    until k>100;(marked as a multiple of i) end;

    for i:=2 to 100 do

    if a[i]<>0 then writeln(i);

    end.Pure screening method.

  11. Anonymous users2024-02-06

    First of all, there are two clerical errors:

    c:=0 instead of c:=o;

    b:=i mod a;Instead of ending with a colon.

    Logical error: The judgment of whether c is less than or equal to 2 should be placed outside the inner loop, as should the initialization of c. (b does not need to be initialized).

    After the change:

    program ex8;

    vari,a,b,c,d:integer;

    beginfor i:=1 to 100 do beginc:=0;

    for a:=1 to i dobegin

    b:=i mod a;

    if b=0

    then c:=c+1;

    end;if c<=2

    then writeln('i=',i);

    end;end.

  12. Anonymous users2024-02-05

    Complete number: The sum of the factors (except itself) is equal to the number of program cs4 of itself;

    var i,n,s:integer;

    begins:=0;

    for n:=2 to 100 do

    beginfor i:=1 to n-1 do

    beginif n mod i =0 then s:=s+i;

    end;if s=n then writeln(n);

    s:=0;end;

    end.

  13. Anonymous users2024-02-04

    A perfect number is defined as a number where the sum of all factors (except itself) is equal to itself, and is called a complete number.

Related questions
7 answers2024-08-15

f(x)=cos³x+sin³x,f'(x)=3cos²x(-sinx)+3sin²x(cosx)=3sinxcosx(sinx-cosx),f'(x)=0, i.e. x=k+2, or x=k+4, kz, x (2k, 4+2k), sinx>0, cosx>0, sinx-cosx<0, so f'(x) <0, f(x) monotonically decreasing; >>>More

8 answers2024-08-15

The 44th power is the 22nd power, which is the 11th power, equal to the 10th power multiplied. It is multiplied by the power of 5, equal to the power of 4 times to the power of 2, i.e. to the power of 6. That is, to the 3rd power, equal to the 2nd power multiplied. >>>More

15 answers2024-08-15

The -1 power of 3 is one-third.

The process is as follows: >>>More

11 answers2024-08-15

1. If the 2nd power of (a b) = 5 and ab = 1, then a-b = (1). >>>More

11 answers2024-08-15

Solution: a=3 to the 55th power = (3 to the fifth power) to the 11th power. >>>More