CS 101 Problem Set-2 (For Practice, Not to Be Submitted) Problems Requiring Iterative Solutions
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
1 Mersenne Primes and Perfect Numbers
1 Mersenne Primes and Perfect Numbers Basic idea: try to construct primes of the form an − 1; a, n ≥ 1. e.g., 21 − 1 = 3 but 24 − 1=3· 5 23 − 1=7 25 − 1=31 26 − 1=63=32 · 7 27 − 1 = 127 211 − 1 = 2047 = (23)(89) 213 − 1 = 8191 Lemma: xn − 1=(x − 1)(xn−1 + xn−2 + ···+ x +1) Corollary:(x − 1)|(xn − 1) So for an − 1tobeprime,weneeda =2. Moreover, if n = md, we can apply the lemma with x = ad.Then (ad − 1)|(an − 1) So we get the following Lemma If an − 1 is a prime, then a =2andn is prime. Definition:AMersenne prime is a prime of the form q =2p − 1,pprime. Question: are they infinitely many Mersenne primes? Best known: The 37th Mersenne prime q is associated to p = 3021377, and this was done in 1998. One expects that p = 6972593 will give the next Mersenne prime; this is close to being proved, but not all the details have been checked. Definition: A positive integer n is perfect iff it equals the sum of all its (positive) divisors <n. Definition: σ(n)= d|n d (divisor function) So u is perfect if n = σ(u) − n, i.e. if σ(u)=2n. Well known example: n =6=1+2+3 Properties of σ: 1. σ(1) = 1 1 2. n is a prime iff σ(n)=n +1 p σ pj p ··· pj pj+1−1 3. If is a prime, ( )=1+ + + = p−1 4. (Exercise) If (n1,n2)=1thenσ(n1)σ(n2)=σ(n1n2) “multiplicativity”. -
Prime Divisors in the Rationality Condition for Odd Perfect Numbers
Aid#59330/Preprints/2019-09-10/www.mathjobs.org RFSC 04-01 Revised The Prime Divisors in the Rationality Condition for Odd Perfect Numbers Simon Davis Research Foundation of Southern California 8861 Villa La Jolla Drive #13595 La Jolla, CA 92037 Abstract. It is sufficient to prove that there is an excess of prime factors in the product of repunits with odd prime bases defined by the sum of divisors of the integer N = (4k + 4m+1 ℓ 2αi 1) i=1 qi to establish that there do not exist any odd integers with equality (4k+1)4m+2−1 between σ(N) and 2N. The existence of distinct prime divisors in the repunits 4k , 2α +1 Q q i −1 i , i = 1,...,ℓ, in σ(N) follows from a theorem on the primitive divisors of the Lucas qi−1 sequences and the square root of the product of 2(4k + 1), and the sequence of repunits will not be rational unless the primes are matched. Minimization of the number of prime divisors in σ(N) yields an infinite set of repunits of increasing magnitude or prime equations with no integer solutions. MSC: 11D61, 11K65 Keywords: prime divisors, rationality condition 1. Introduction While even perfect numbers were known to be given by 2p−1(2p − 1), for 2p − 1 prime, the universality of this result led to the the problem of characterizing any other possible types of perfect numbers. It was suggested initially by Descartes that it was not likely that odd integers could be perfect numbers [13]. After the work of de Bessy [3], Euler proved σ(N) that the condition = 2, where σ(N) = d|N d is the sum-of-divisors function, N d integer 4m+1 2α1 2αℓ restricted odd integers to have the form (4kP+ 1) q1 ...qℓ , with 4k + 1, q1,...,qℓ prime [18], and further, that there might exist no set of prime bases such that the perfect number condition was satisfied. -
Triangular Numbers /, 3,6, 10, 15, ", Tn,'" »*"
TRIANGULAR NUMBERS V.E. HOGGATT, JR., and IVIARJORIE BICKWELL San Jose State University, San Jose, California 9111112 1. INTRODUCTION To Fibonacci is attributed the arithmetic triangle of odd numbers, in which the nth row has n entries, the cen- ter element is n* for even /?, and the row sum is n3. (See Stanley Bezuszka [11].) FIBONACCI'S TRIANGLE SUMS / 1 =:1 3 3 5 8 = 2s 7 9 11 27 = 33 13 15 17 19 64 = 4$ 21 23 25 27 29 125 = 5s We wish to derive some results here concerning the triangular numbers /, 3,6, 10, 15, ", Tn,'" »*". If one o b - serves how they are defined geometrically, 1 3 6 10 • - one easily sees that (1.1) Tn - 1+2+3 + .- +n = n(n±M and (1.2) • Tn+1 = Tn+(n+1) . By noticing that two adjacent arrays form a square, such as 3 + 6 = 9 '.'.?. we are led to 2 (1.3) n = Tn + Tn„7 , which can be verified using (1.1). This also provides an identity for triangular numbers in terms of subscripts which are also triangular numbers, T =T + T (1-4) n Tn Tn-1 • Since every odd number is the difference of two consecutive squares, it is informative to rewrite Fibonacci's tri- angle of odd numbers: 221 222 TRIANGULAR NUMBERS [OCT. FIBONACCI'S TRIANGLE SUMS f^-O2) Tf-T* (2* -I2) (32-22) Ti-Tf (42-32) (52-42) (62-52) Ti-Tl•2 (72-62) (82-72) (9*-82) (Kp-92) Tl-Tl Upon comparing with the first array, it would appear that the difference of the squares of two consecutive tri- angular numbers is a perfect cube. -
Twelve Simple Algorithms to Compute Fibonacci Numbers Arxiv
Twelve Simple Algorithms to Compute Fibonacci Numbers Ali Dasdan KD Consulting Saratoga, CA, USA [email protected] April 16, 2018 Abstract The Fibonacci numbers are a sequence of integers in which every number after the first two, 0 and 1, is the sum of the two preceding numbers. These numbers are well known and algorithms to compute them are so easy that they are often used in introductory algorithms courses. In this paper, we present twelve of these well-known algo- rithms and some of their properties. These algorithms, though very simple, illustrate multiple concepts from the algorithms field, so we highlight them. We also present the results of a small-scale experi- mental comparison of their runtimes on a personal laptop. Finally, we provide a list of homework questions for the students. We hope that this paper can serve as a useful resource for the students learning the basics of algorithms. arXiv:1803.07199v2 [cs.DS] 13 Apr 2018 1 Introduction The Fibonacci numbers are a sequence Fn of integers in which every num- ber after the first two, 0 and 1, is the sum of the two preceding num- bers: 0; 1; 1; 2; 3; 5; 8; 13; 21; ::. More formally, they are defined by the re- currence relation Fn = Fn−1 + Fn−2, n ≥ 2 with the base values F0 = 0 and F1 = 1 [1, 5, 7, 8]. 1 The formal definition of this sequence directly maps to an algorithm to compute the nth Fibonacci number Fn. However, there are many other ways of computing the nth Fibonacci number. -
Number World Number Game "Do You Like Number Games?", Zaina Teacher Asked
1 Number World Number game "Do you like number games?", Zaina teacher asked. "Oh! Yes!", said the children. "I'll say a number; you give me the next number at once. Ready?" "Ready!" "Ten", teacher began. "Eleven", said all the children. "Forty three" "Forty four" The game went on. "Four thousand ninety nine", teacher said. "Five thousand", replied some one. "Oh! No!... Four thousand and hundred", some caught on. Such mistakes are common. Try this on your friends. First Day Fiesta What is the number of children in First Day Fiesta class 1? What is the largest number you can read? What is the largest four-digit number? What is the next number? 435268 children in Class 1. 8 And the largest five-digit number? What is the next number? How do we find this number? Giant number How do we read it? Look at the table of large numbers: If we are asked for a large number, we often say crore or hundred crore. Put- 1 One ting ten zeros after one makes thou- 10 Ten sand crore. Think about the size of the number with hundred zeros after one. 100 Hundred This is called googol. This name was 1000 Thousand popularized by Edward Kasner in 10000 Ten thousand 1938. 100000 Lakh In most countries, one lakh is named hundred thousand and ten lakh is 1000000 Ten lakh named million. 10000000 Crore 100000000 Ten crore You're always counting This continues with hundred crore, thousand numbers! What's crore, and so on. your goal? Now can you say what we get when we add one Googol! to ninety nine thousand nine hundred and ninety nine? 99999 + 1 = 100000 How do we read this? Look it up in the table. -
On Perfect and Multiply Perfect Numbers
On perfect and multiply perfect numbers . by P. ERDÖS, (in Haifa . Israel) . Summary. - Denote by P(x) the number o f integers n ~_ x satisfying o(n) -- 0 (mod n.), and by P2 (x) the number of integers nix satisfying o(n)-2n . The author proves that P(x) < x'314:4- and P2 (x) < x(t-c)P for a certain c > 0 . Denote by a(n) the sum of the divisors of n, a(n) - E d. A number n din is said to be perfect if a(n) =2n, and it is said to be multiply perfect if o(n) - kn for some integer k . Perfect numbers have been studied since antiquity. l t is contained in the books of EUCLID that every number of the form 2P- ' ( 2P - 1) where both p and 2P - 1 are primes is perfect . EULER (1) proved that every even perfect number is of the above form . It is not known if there are infinitely many even perfect numbers since it is not known if there are infinitely many primes of the form 2P - 1. Recently the electronic computer of the Institute for Numerical Analysis the S .W.A .C . determined all primes of the form 20 - 1 for p < 2300. The largest prime found was 2J9 "' - 1, which is the largest prime known at present . It is not known if there are an odd perfect numbers . EULER (') proved that all odd perfect numbers are of the form (1) pam2, p - x - 1 (mod 4), and SYLVESTER (') showed that an odd perfect number must have at least five distinct prime factors . -
Input for Carnival of Math: Number 115, October 2014
Input for Carnival of Math: Number 115, October 2014 I visited Singapore in 1996 and the people were very kind to me. So I though this might be a little payback for their kindness. Good Luck. David Brooks The “Mathematical Association of America” (http://maanumberaday.blogspot.com/2009/11/115.html ) notes that: 115 = 5 x 23. 115 = 23 x (2 + 3). 115 has a unique representation as a sum of three squares: 3 2 + 5 2 + 9 2 = 115. 115 is the smallest three-digit integer, abc , such that ( abc )/( a*b*c) is prime : 115/5 = 23. STS-115 was a space shuttle mission to the International Space Station flown by the space shuttle Atlantis on Sept. 9, 2006. The “Online Encyclopedia of Integer Sequences” (http://www.oeis.org) notes that 115 is a tridecagonal (or 13-gonal) number. Also, 115 is the number of rooted trees with 8 vertices (or nodes). If you do a search for 115 on the OEIS website you will find out that there are 7,041 integer sequences that contain the number 115. The website “Positive Integers” (http://www.positiveintegers.org/115) notes that 115 is a palindromic and repdigit number when written in base 22 (5522). The website “Number Gossip” (http://www.numbergossip.com) notes that: 115 is the smallest three-digit integer, abc, such that (abc)/(a*b*c) is prime. It also notes that 115 is a composite, deficient, lucky, odd odious and square-free number. The website “Numbers Aplenty” (http://www.numbersaplenty.com/115) notes that: It has 4 divisors, whose sum is σ = 144. -
Crazy Representations of Natural Numbers, Selfie Numbers
Inder J. Taneja RGMIA Research Report Collection, 19(2016), pp.1-37, http://rgmia.org/v19.php Crazy Representations of Natural Numbers, Selfie Numbers, Fibonacci Sequence, and Selfie Fractions Inder J. Taneja1 SUMMARY This summary brings author’s work on numbers. The study is made in different ways. Specially, towards, Crazy Representations of Natural Numbers, Running Expressions, Selfie Numbers etc. Natural numbers are represented in different situations, such as, writing in terms of 1 to 9 or reverse, flexible power of same digits as bases, single digit, single letter, etc. Expressions appearing with equalities having 1 to 9 or 9 to 1 or 9 to 0, calling running expressions are also presented. In continuation, there is work is on selfie numbers, unified, patterns, symmetrical representations in selfie numbers, Fibonacci sequence and selfie numbers, flexible power Narcissistic and selfie numbers, selfie fractions, etc. The selfie numbers may also be considered as generalized or wild narcissistic numbers, where natural numbers are represented by their own digits with certain operations. The study is also made towards equivalent fractions and palindromic-type numbers. This summary is separated by sections and subsections given as follows: 1 Crazy Representations of Natural Numbers [1]; 2 Flexible Power Representations [34]; 2.1 Unequal String Lengths [33]; 2.2 Equal String Lengths [25]; 3 Pyramidical Representations [20, 24, 31, 32]; 3.1 Crazy Representations [33]; 3.2 Flexible Power [25]; 4 Double Sequential Representations [20, 24, 31, 32]; 5 Triple Sequential Representations; [35]; 6 Single Digit Representations; [2]; 7 Single Letter Representations [4, 8]; 7.1 Single Letter Power Representations [8]; 7.2 Palindromic and Number Patterns [9, 10]; 8 Running Expressions. -
ON PERFECT and NEAR-PERFECT NUMBERS 1. Introduction a Perfect
ON PERFECT AND NEAR-PERFECT NUMBERS PAUL POLLACK AND VLADIMIR SHEVELEV Abstract. We call n a near-perfect number if n is the sum of all of its proper divisors, except for one of them, which we term the redundant divisor. For example, the representation 12 = 1 + 2 + 3 + 6 shows that 12 is near-perfect with redundant divisor 4. Near-perfect numbers are thus a very special class of pseudoperfect numbers, as defined by Sierpi´nski. We discuss some rules for generating near-perfect numbers similar to Euclid's rule for constructing even perfect numbers, and we obtain an upper bound of x5=6+o(1) for the number of near-perfect numbers in [1; x], as x ! 1. 1. Introduction A perfect number is a positive integer equal to the sum of its proper positive divisors. Let σ(n) denote the sum of all of the positive divisors of n. Then n is a perfect number if and only if σ(n) − n = n, that is, σ(n) = 2n. The first four perfect numbers { 6, 28, 496, and 8128 { were known to Euclid, who also succeeded in establishing the following general rule: Theorem A (Euclid). If p is a prime number for which 2p − 1 is also prime, then n = 2p−1(2p − 1) is a perfect number. It is interesting that 2000 years passed before the next important result in the theory of perfect numbers. In 1747, Euler showed that every even perfect number arises from an application of Euclid's rule: Theorem B (Euler). All even perfect numbers have the form 2p−1(2p − 1), where p and 2p − 1 are primes. -
+P.+1 P? '" PT Hence
1907.] MULTIPLY PEKFECT NUMBERS. 383 A TABLE OF MULTIPLY PERFECT NUMBERS. BY PEOFESSOR R. D. CARMICHAEL. (Read before the American Mathematical Society, February 23, 1907.) A MULTIPLY perfect number is one which is an exact divisor of the sum of all its divisors, the quotient being the multiplicity.* The object of this paper is to exhibit a method for determining all such numbers up to 1,000,000,000 and to give a complete table of them. I include an additional table giving such other numbers as are known to me to be multiply perfect. Let the number N, of multiplicity m (m> 1), be of the form where pv p2, • • •, pn are different primes. Then by definition and by the formula for the sum of the factors of a number, we have +P? -1+---+p + ~L pi" + Pi»'1 + • • (l)m=^- 1 •+P.+1 p? '" PT Hence (2) Pi~l Pa"1 Pn-1 These formulas will be of frequent use throughout the paper. Since 2•3•5•7•11•13•17•19•23 = 223,092,870, multiply perfect numbers less than 1,000,000,000 contain not more than nine different prime factors ; such numbers, lacking the factor 2, contain not more than eight different primes ; and, lacking the factors 2 and 3, they contain not more than seven different primes. First consider the case in which N does not contain either 2 or 3 as a factor. By equation (2) we have (^\ «M ^ 6 . 7 . 11 . 1£. 11 . 19 .2ft « 676089 [Ö) m<ï*6 TTT if 16 ï¥ ïî — -BTÏTT6- Hence m=2 ; moreover seven primes are necessary to this value. -
Fibonacci Numbers
mathematics Article On (k, p)-Fibonacci Numbers Natalia Bednarz The Faculty of Mathematics and Applied Physics, Rzeszow University of Technology, al. Powsta´nców Warszawy 12, 35-959 Rzeszów, Poland; [email protected] Abstract: In this paper, we introduce and study a new two-parameters generalization of the Fibonacci numbers, which generalizes Fibonacci numbers, Pell numbers, and Narayana numbers, simultane- ously. We prove some identities which generalize well-known relations for Fibonacci numbers, Pell numbers and their generalizations. A matrix representation for generalized Fibonacci numbers is given, too. Keywords: Fibonacci numbers; Pell numbers; Narayana numbers MSC: 11B39; 11B83; 11C20 1. Introduction By numbers of the Fibonacci type we mean numbers defined recursively by the r-th order linear recurrence relation of the form an = b1an−1 + b2an−2 + ··· + bran−r, for n > r, (1) where r > 2 and bi > 0, i = 1, 2, ··· , r are integers. For special values of r and bi, i = 1, 2, ··· r, the Equality (1) defines well-known numbers of the Fibonacci type and their generalizations. We list some of them: Citation: Bednarz, N. On 1. Fibonacci numbers: Fn = Fn−1 + Fn−2 for n > 2, with F0 = F1 = 1. (k, p)-Fibonacci Numbers. 2. Lucas numbers: Ln = Ln−1 + Ln−2 for n > 2, with L0 = 2, L1 = 1. Mathematics 2021, 9, 727. https:// 3. Pell numbers: Pn = 2Pn−1 + Pn−2 for n > 2, with P0 = 0, P1 = 1. doi.org/10.3390/math9070727 4. Pell–Lucas numbers: Qn = 2Qn−1 + Qn−2 for n > 2, with Q0 = 1, Q1 = 3. 5. Jacobsthal numbers: Jn = Jn−1 + 2Jn−2 for n > 2, with J0 = 0, J1 = 1. -
On Repdigits As Product of Consecutive Fibonacci Numbers1
Rend. Istit. Mat. Univ. Trieste Volume 44 (2012), 393–397 On repdigits as product of consecutive Fibonacci numbers1 Diego Marques and Alain Togbe´ Abstract. Let (Fn)n≥0 be the Fibonacci sequence. In 2000, F. Luca proved that F10 = 55 is the largest repdigit (i.e. a number with only one distinct digit in its decimal expansion) in the Fibonacci sequence. In this note, we show that if Fn ··· Fn+(k−1) is a repdigit, with at least two digits, then (k, n) = (1, 10). Keywords: Fibonacci, repdigits, sequences (mod m) MS Classification 2010: 11A63, 11B39, 11B50 1. Introduction Let (Fn)n≥0 be the Fibonacci sequence given by Fn+2 = Fn+1 + Fn, for n ≥ 0, where F0 = 0 and F1 = 1. These numbers are well-known for possessing amaz- ing properties. In 1963, the Fibonacci Association was created to provide an opportunity to share ideas about these intriguing numbers and their applica- tions. We remark that, in 2003, Bugeaud et al. [2] proved that the only perfect powers in the Fibonacci sequence are 0, 1, 8 and 144 (see [6] for the Fibono- mial version). In 2005, Luca and Shorey [5] showed, among other things, that a non-zero product of two or more consecutive Fibonacci numbers is never a perfect power except for the trivial case F1 · F2 = 1. Recall that a positive integer is called a repdigit if it has only one distinct digit in its decimal expansion. In particular, such a number has the form a(10m − 1)/9, for some m ≥ 1 and 1 ≤ a ≤ 9.