← Back to challenges

Quad Sequence

JavaScriptHardalgebramathnumbers

Instructions

Write a function that receives an array of x integers and returns an array of x integers in the Nth term of a quadratic number sequence (where x is the length of the incoming array). Your function should return the continuation of the quadratic sequence of the length equal to the length of the given array.

Examples

quadSequence([48, 65, 84]) ➞ [105, 128, 153]

quadSequence([0, 1, 6, 15, 28]) ➞ [45, 66, 91, 120, 153]

quadSequence([9, 20, 33, 48]) ➞ [65, 84, 105, 128]

Notes

Both positive and negative numbers are included in the test cases.

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.