Download RAFINARE IN PASI SUCCESIVI

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Infinity wikipedia , lookup

Infinitesimal wikipedia , lookup

Location arithmetic wikipedia , lookup

Positional notation wikipedia , lookup

Bra–ket notation wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Hyperreal number wikipedia , lookup

Non-standard analysis wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Arithmetic wikipedia , lookup

Sequence wikipedia , lookup

Collatz conjecture wikipedia , lookup

Large numbers wikipedia , lookup

Real number wikipedia , lookup

P-adic number wikipedia , lookup

Basis (linear algebra) wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
STEPWISE REFINEMENT
1. Let us consider the natural number n, the real number a, and the vector
X = (x1, x2, ... , xn).
Without sorting these elements, and with the smallest number of swaps, arrange the elements such
that all components smaller than a are placed before all elements larger than a.
2. Let us consider the natural number n and the vector
X = (x[1], x[2], ... , x[m])
Remove all repeating values from X.
3. Let us consider the sequence X given below:
4, 2, 2, 6, 2, 2, 3, 3, 3, 8, 2, 2, 4, 4, 4, 4, ...
Obtained from the composed natural numbers followed by their proper divisors, each divisor d
being written d times. Print the sequence of numbers starting with X[n] and ending with X[n+p] for
n and p given, without memorizing the vector X.
4. The integer numbers x[1], x[2], ... , x[n] are given. Find the longest sequence x(l), x(l+1), ... ,
x(k) such that x(l) = x(l+1) = ... = x(k).
5. Let us consider the sequence X given by
1,2,3,4, 2, 5, 6, 2, 3, 7, 8, 2, 4, 9, 3, 10, 2, 5, 11, ...
obtained from the natural numbers, by inserting after each composed number its proper divisors.
Print the sequence of numbers starting with X[n] and ending with X[n+p] for n and p given,
without memorizing the vector X.
6. The vector X with n components is given. Find the longest sequence of consecutive components
that has only two distinct values.
For problems 7-10
We consider the representation of numbers in different numeration bases. Thus, the representation
of the natural number A in basis p has the form
(a[n] . . . a[2]a[1]a[0])
a[i], i=0..n being the digits of the representation. So, A is given as a vector of digits.
7. Two natural numbers A and B are given by their representation in the basis p. Compare the
numbers. Otherwise stated, compute r=1 if A<B, 2 if A>B and 3 if A=B.
8. Two natural numbers A and B are given by their representation in the basis p. Compute the sum
of the two numbers.
9. The natural number A is given by its representation in the basis p. Compute the representation of
A in basis q.
10. Two natural numbers A and B are given by their representation in the basis p. Compute the
quotient and the remainder of the division of number A to number B (B non-null 0) by repeated
subtractions.
11. Compute the integer roots and their order of multiplicity for a given polynomial with integer
coefficients.
For problems 12 – 15
Let n be a given natural number. Print the matrix A[1..n,1..n] with elements from the sequence X
and positioned in the following order:
a[1,1], a[1,2],...,a[1,n],a[2,n],...,a[n,n],...a[n,1], a[n-1,1],...
a[2,1], a[2,2],...,a[2,n-1],...,a[n-1,n-1], ...
without memorizing the vector X, where:
12. X is the sequence of prime numbers: 2,3,5,7,11, ...
13. X=(1,2,3,4,2,5,6,2,3,7,8,2,4,9,3,10,2,5,11,...)
formed from the sequence of natural numbers by inserting after each composed number its proper
divisors.
14. X=(4,2,2,6,2,2,3,3,3,8,2,2,4,4,4,4,9,3,3,3,10,2,2,5,5,...)
formed from the sequence of natural numbers by inserting after each composed number its proper
divisors, each divisor d being written d times.
15. X=(1,2,2,3,3,3,5,5,5,5,5,....)
formed by prime numbers, each number p being written p times.