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

  • Context: Java 
  • Thread starter Thread starter Aman Gaur
  • Start date Start date
  • Tags Tags
    Program Series
Click For Summary

Discussion Overview

The discussion revolves around creating a program to generate a specific numerical series (0, 3, 8, 15, 24, 35...) and includes additional programming challenges. Participants explore patterns in the series, propose programming solutions, and seek clarification on related programming tasks.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant asks for help in writing a program to generate the series.
  • Another participant suggests discovering a pattern in the numbers to simplify the programming task.
  • A Pari program is provided as a potential solution, which outputs the series in a specific format.
  • Some participants identify the pattern as related to the differences between the numbers being odd numbers.
  • Another participant hints at a mathematical relationship involving the expression (n+1)^2 - n^2, suggesting a connection to odd numbers.
  • Several participants express gratitude for assistance and request help with additional programming tasks, including generating a different series and calculating income tax based on employee grades.
  • A participant seeks clarification on how to calculate income tax on a monthly basis when the problem states it is based on annual salary.

Areas of Agreement / Disagreement

Participants generally agree on the existence of a pattern in the series, but there are multiple interpretations of that pattern and no consensus on the best programming approach. The discussion about the income tax calculation remains unresolved, with differing understandings of the requirements.

Contextual Notes

Some assumptions about the patterns in the series and the requirements for the income tax calculation are not fully articulated, leading to potential confusion. The relationship between the series and the mathematical expressions is not completely explored.

Who May Find This Useful

Individuals interested in programming challenges, particularly in generating numerical series and understanding basic income tax calculations in programming contexts.

Aman Gaur
Messages
6
Reaction score
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
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.
 
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
 
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
 
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?
 
i didn't get it...sorry
 
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
 
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
 
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...
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
3
Views
4K
  • · Replies 25 ·
Replies
25
Views
3K
Replies
10
Views
2K