Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,147 members, 7,815,017 topics. Date: Thursday, 02 May 2024 at 04:51 AM |
Nairaland Forum / Science/Technology / Programming / Try This Math Problem (1584 Views)
Test-run My Math Algorithms Open Display Library Site / Math/programming Puzzle - Finding All Expressions That Evaluates To Some Value / Check Out My New Android Math Game (2) (3) (4)
Try This Math Problem by Kodejuice: 3:31pm On Feb 06, 2016 |
The common difference of a arithmetric progression are (+3) and (-2) respectively. E.g => if the first term of this sequence is 4, the terms would be: 4, 7, 5, 8, 6, 9, 7 i.e 4, (+3), 7, (-2), 5, (+3), 8, (-2), 6, ... The task here is to come up with a formulae to get the nth term of such sequence. |
Re: Try This Math Problem by Nobody: 1:23pm On Feb 07, 2016 |
Solution.... First, this isn't a geometric progression but more like an arithmetic progression, it has two sequences therefore it must have two initial starting points.... Let the sequence appear in this structure, a0,a1,a2,a3,a4,....(a)(n+2) or (a)(n) for all n(0 to infinity)................. Statement 1... From statement one, we can derive two conditions, a0= 4, and a1 =7.... Therefore, statement 1 appears like this; 4,7,a2,a3,a4,....(a)(n+2) or (a)(n).... Statement 2... The nth term for both sequences therefore will be, a(n+2) = a(n) + 1 ( if a0 = 4 and if and only if n = [0,2,4,6,..., 2(n)] ••••••• Equation 1... Similarly, a(n+2) = a(n) + 1 ( if a1 = 7 and if and only if n = [1,3,5,7,..., 2(n)+1] ••••••• Equation 2... These formulas enables us to determine the nth term in an implicit approach, it could also be determined in an explicit manner but would require traversing equ 1 and 2.... So for Example, If our solution appears like this 4,7,5,8,6,9,7,10,8,11,9 a0 = 4 a1=7 Let's find a7, of cause a7 =10.... Solution Since n= 7, therefore let's apply equation 2 which means a1 =7 Therefore, a7 = a ( n+2) means n =5... So, a(5 +2)= [a5 +1].... a7 = [a5 + 1] = [ (a3 + 1) + 1 ] = [ ((( a1 + 1)+1)+1)] Remember, a1 = 7 Therefore, a7 = [((( 7+1) + 1)+1)] = [((( + 1) +1)] = [((8+1) + 1)] =[((9)+1)] = 10.... Answer So you see, it works but this method can appear tedious when working with large terms, so I recommend using a programming language such as Java or C++ and applying my algorithm... To find more complex terms.... Thanks for reading!!! 1 Like 1 Share |
Re: Try This Math Problem by DonSegmond(m): 11:52am On Feb 08, 2016 |
Let n = 0. then the sequence is 0,3,1,4,2,5,3,6,4 looking at that sequence, we can see than for all odd sequences, it is 0,1,2,3,4 and for all even sequences it is 3,4,5,6 Given a starting number v at index n to find the pattern if n is odd, then the nth sequence is ((n - 1) / 2) + v if n is even, then it is ((n / 2) + 2) + v So given a sequence that begins with 4, to find the 7th sequence given that 7 is odd, ((n - 1) / 2) + v = ((7 - 1) / 2) + 4 = 6/2 + 4 = 3+4 = 7 If 6th sequence given that 6 is even ((n / 2) + 2) + v = (6/2) + 2 + 4 = 3 + 2 + 4 = 9 Given a sequence that begins with 17 to find the 12,345,678 - 12,345,680 numbers 12,345,678 sequence (12345678/2) + 2 + 17 = 6172858 12,345,679 sequence ((12345679 - 1 )/2) + 17 = 6172856 12,345,680 sequence (12345680/2) + 2 + 17 = 6172859 1 Like |
Re: Try This Math Problem by asalimpo(m): 6:52am On Feb 11, 2016 |
//language = java public class Test { public static void main(final String... args) throws Exception { // printing out first 7 terms int ft=4; int p1=3; int p2=-2; System.out.println(); for(int x=1;x<=7;x++) { int res = nthTerm(ft,x,p1,p2); System.out.print(" "+res); } } //ft=first term, n = nth term, p1=first difference , p2 = second difference public static int nthTerm(final int ft,final int n,final int p1,final int p2) { if(n<=1) return ft; else { int currentTerm = (n%2==0)?p1:p2; if(n==2) return ft+currentTerm; return nthTerm(ft,n-1,p1,p2)+currentTerm; } } } |
Re: Try This Math Problem by Sirnuel: 10:00am On Feb 11, 2016 |
using c++ ====================================================================== #include <iostream> using std::cin; using std::cout; int main(){ cout << "A program to find the nth term of a sequence with the difference (+3) and (-2)\n\n"; int first; int nth_term; cout << "Enter the first term of the sequence: \t"; cin >> first; cout << std::endl; cout << "Enter the nth term you want to find: \t"; cin >> nth_term; cout << std::endl; int answer = first; for (int i = 0; i < nth_term; i++){ cout << answer << " "; if ((i%2)!= 0){ answer = (answer + (-2)); } else { answer = (answer + 3); } } cout << "\n\n"; cout << "The " << nth_term << " of the sequence is: " << answer; return 0; } |
Re: Try This Math Problem by exxy(m): 6:23am On Feb 12, 2016 |
Math Tutor Purpose This assignment is designed to help students in using C++ to perform basic calculations. Students will also gain experience with generating randon numbers. Problem Statement Write a program that can be used as a math tutor for a young student. The program should display two random numbers between 1 and 9 to be added, subtracted, multimplied, and divided, such as 3 * 9 = Help me with this math problem using C++ After the student has entered an answer and pressed the [Enter] key, the program should display the correct answer so the student can see if his or her answer is correct. Sample Output 3 + 9 = 12 That's Correct 3 - 9 = 6 Sorry, That's not correct, the correct answer is -6 3 X 9 = 27 That's Correct 3 / 9 = 0.333 Sorry, That's not correct, the correct answer is 0 |
(1) (Reply)
How Did You Get Into Tech?(what Motivated You, Downfalls, What Discourage You) / Javascript Showing Me Pepper / Nairaland Mobile App
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 34 |