0% found this document useful (0 votes)
16 views3 pages

Image To PDF - 21102023 - 235305

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Image To PDF - 21102023 - 235305

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
University of Dhaka, Department of Mathematics First Year B. S. (Honors) 2023 Course: MTH 150 (Math Lab I) ‘Topic: Number Thoery Key Commands: Input, Print, Prime, PrimeQ, NextPrime, Divisors, DivisorSigma, Fibonacci, ‘Sum, Product, Union, Intersection, Mean, GeometricMean, Table, TableForm, TableHeadings , Print, For, Do, While, Solve, ConstantArray, TableForm, TableDirections etc. 1, Input an integer n > 10, using Input command. Then (@) Test, whether this number is prime or not. Gi) Evaluate the value of 2 — 1 and store the result in a variable, (iii) Find the divisors of n (iv) Find the sum and product of the divisors of n (v) Calculate the n" prime number. (vi) Calculate the n™ Fibonacci number. (vii) Test, whether the number 2?” + 1 is prime or not. (viii) Find the value of n for which 22" +1 is not a prime. (ix) Print the primes which are less than or equal to n. (x) Find the number of primes which are less than or equal to 7. (xi) Print prime numbers between n to 2n. (xii) Compute the sum and the product of the primes numbers obtained in (xi). (xiii) Find the next prime larger than 1. (xiv) Check whether n! + Lis a prime mumber or not. (xv) Find the value of'n for which n! + 1 is not prime. (xvi) Check whether 1 is a perfect number. (xvii) Generate alist of first n positive integer (xviii) Use the result in (xvii) to obtain a list of integer which is divisible by 7 but not divisible by 3. (xix) Obtain a list of prime number from the list obtained in (xviii). The Fibonacci sequence is defined by fy = 1, fy = Land fy = fn-1+ fn-2- Define the Fibonacci fimetion. (i) Use the definition to generate the first 300 values of the sequence. (ii) Use result in (i) to create list of numbers which are prime numbers as well as Fibonacci numbers. 3. Construct a table showing the radian equivalents of angles from 0° to 60" in increments of 5. Output should have label of columns “degree” and “Radian” and divide the label and values by a vertical line and the label by horizontal line. Page 1 of 3 Suppose A, B, C contains 3 positive numbers. Write a code to determine whether A, B,C can form a triangle. If not, print the message ‘Not a Triangle’; If yes, determine whether A, B,C fom the sides of i, Anequilateral triangle ii, Anisosceles triangle iii, A right angle triangle A palindromic number is a number that remains the same when its digits are reversed. Write a code that will print all palindromic numbers between 100 and 200 by reversing each number Input an integer 1 > 10, using Input command (Calculate the value of n! using For loop (ii) Do the same using Do loop (ii) Solve the problem again using While Loop. (Write a code that takes an integer n as input and prints an n X nm square of "stars" as output. Use For Loop. Here is a sample output forn = 4 sees (i) Copy your code for question 3a and modify it so that it prints a triangle of "stars". Here is a sample output for n = 4 (ii) Copy your code for question 3b and modify itso that it prints a triangle of numbers in the following pattern. Sample output form = 4: 1 12 123 1234 (iv) Nowusing the experience so far, write a code that prints a right-triangle version of the Pascal’s triangle. Sample output for n = 5: 1 ae Page 2 of 3 9, A multiplication table can be defined as 1] 2);3)4/]5 2| 4) 6/8 | 10 3 | 6 | 9 | 12/45 4 | 8 | 12] 16 | 20 ‘Use a nested for loop to print a 10 x 10 multiplication table Page 3 of 3

You might also like