Solve the Program: Create a Series 0, 3, 8, 15, 24, 35...

In summary: There's a difference between annual and monthly income taxes. Monthly income taxes are paid based on your net income each month. Annual income taxes are paid based on your total income for the year.
  • #1
Aman Gaur
6
0
can anyone help in solving this program...

write a program to create the series as 0 ,3 ,8 ,15 ,24 ,35...till n terms
 
Technology news on Phys.org
  • #2
Tell us if you have discovered the "pattern" in those numbers yet? Once you know the pattern then I think the program to generate those numbers should be very easy.
 
  • #3
Here's a Pari program you can convert:

Code:
seq(n)=print1(0);for(k=1,n-1,print1(" ,"if(k%6,[3,8,15,24,35][k%6],0)))

Output for seq(20):
Code:
0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3
 
  • #4
i understood the pattern as the difference between the series is like series of odd numbers...i don't know wat r u thinking it at as...the reply u have given cannot be used in java...

can u help me to understand better...please
 
  • #5
Aman Gaur said:
i understood the pattern as the difference between the series is like series of odd numbers

Yes that's good, you could certainly implement that pattern in java. Have you made any attempt to implement it yet?

There is actually an even easier pattern to those numbers (other than the "difference = increasing sequence of odd numbers" one that you've already found).

Here's a hint: What do you get when you expand and simplify the expression [itex](n+1)^2 - n^2[/itex] and how does this relate to a sequence of increasing odd numbers?
 
  • #6
i didn't get it...sorry
 
  • #7
thank you sir...i got it ...as you said it...

thank you very much...

i need you help in another one like that...it says

write a program to print the following series as
55555
54444
54333
54322
54321
 
  • #8
Aman Gaur said:
thank you sir...i got it ...as you said it...

thank you very much...

i need you help in another one like that...it says

write a program to print the following series as
55555
54444
54333
54322
54321

55555-54321 = ?
54444-54321 = ?
54333-54321 = ?
54322-54321 = ?
54321-54321 = ?

Find relationship

so values ...f(x) = g(x) + 54321

run a simple for loop
 
  • #9
thank you sir,,,,,i am very thankful of yours to help me out in this crucial way...

thanks a lot...

u r amazing
 
  • #10
sir i just want to clarify one statement that i am not able to understand...and that is

there is question regarding incometax which we have to make a program on java


a company has employees who are divided into four grades as follows :
grade basic DA(of basic) HRA(of basic)
1 10000 or more 40% 30%
2 5000 - <10000 40% 25%
3 <5000 but >2000 30% 20%
4 <= 2000 30% 15%

this statement...

"if the net salary which is the total of BASIC ,DA ,HRA is above Rs 50,000 per month then incometax at the rate of 30 % of the annual salary exceeding Rs 50,000 is deducted on monthly basis at source."

Taking the name of the employees and the basic monthly pay as inputs , a pay slip which contains name, grade , basic monthly pay ,DA , HRA , monthly income , net monthly salary , for employee is to be printed ...write a program to perform this job..

Sir...how can we find income tax at monthly basis...? when we are given to find it at annual basis...
 

1. What is the pattern in the series?

The pattern in this series is to add 3 to the previous number, then add 1 to the result. This creates the sequence of numbers 0, 3, 8, 15, 24, 35...

2. What is the formula for finding the next number in the series?

The formula for finding the next number in the series is n^2 + 1, where n is the position of the number in the series. For example, the first number in the series is at position 0, so the formula would be 0^2 + 1 = 1. The second number is at position 1, so the formula would be 1^2 + 1 = 2. This continues for each subsequent number in the series.

3. How many terms are in this series?

There is no limit to the number of terms in this series, as it can continue infinitely. However, for practical purposes, the number of terms can be determined by the position of the desired number in the series. For example, to find the 10th number in the series, the formula would be 10^2 + 1 = 101, indicating that there are at least 10 terms.

4. Can this series be written in a different format?

Yes, this series can also be written as 0, 1, 4, 9, 16, 25... by using the formula n^2, where n is the position of the number in the series. However, the original series of 0, 3, 8, 15, 24, 35... follows a different pattern and may be more useful in certain contexts.

5. How is this series used in real-life applications?

This series is often used in mathematics and computer science for various calculations and algorithms. It is also used in physics to describe the motion of an object with constant acceleration. Additionally, this series can be found in various natural phenomena, such as the petals of a flower arranged in a spiral pattern.

Similar threads

  • Programming and Computer Science
Replies
2
Views
312
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
19
Views
977
  • Programming and Computer Science
Replies
3
Views
644
  • Programming and Computer Science
Replies
1
Views
729
  • Programming and Computer Science
Replies
4
Views
616
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
33
Views
2K
  • Programming and Computer Science
Replies
32
Views
2K
  • Programming and Computer Science
Replies
25
Views
2K
Back
Top