# Stella octangula number

Here given code implementation process.

``````// C Program for
// Stella octangula number
#include <stdio.h>

void stellaOctangulaNo(int k)
{
// Print all initial k stella octangula number
for (int n = 0; n < k; ++n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
int result = n *(2 *(n *n) - 1);

// Display calculated result
printf("  %d", result);
}
}
int main()
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
stellaOctangulaNo(10);
return 0;
}``````

#### Output

``  0  1  14  51  124  245  426  679  1016  1449``
``````// Java program for
// Stella octangula number
public class StellaOctangula
{
public void stellaOctangulaNo(int k)
{
// Print all initial k stella octangula number
for (int n = 0; n < k; ++n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
int result = n * (2 * (n * n) - 1);

// Display calculated result
System.out.print(" " + result );
}
}
public static void main(String[] args)
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````// Include header file
#include <iostream>
using namespace std;
// C++ program for
// Stella octangula number
class StellaOctangula
{
public: void stellaOctangulaNo(int k)
{
// Print all initial k stella octangula number
for (int n = 0; n < k; ++n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
int result = n *(2 *(n *n) - 1);

// Display calculated result
cout << " " << result;
}
}
};
int main()
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
return 0;
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````// Include namespace system
using System;
// Csharp program for
// Stella octangula number
public class StellaOctangula
{
public void stellaOctangulaNo(int k)
{
// Print all initial k stella octangula number
for (int n = 0; n < k; ++n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
int result = n * (2 * (n * n) - 1);

// Display calculated result
Console.Write(" " + result);
}
}
public static void Main(String[] args)
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````package main
import "fmt"
// Go program for
// Stella octangula number

func stellaOctangulaNo(k int) {
// Print all initial k stella octangula number
for n := 0 ; n < k ; n++ {
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
var result int = n * (2 * (n * n) - 1)

// Display calculated result
fmt.Print(" ", result)
}
}
func main() {

// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
stellaOctangulaNo(10)
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````<?php
// Php program for
// Stella octangula number
class StellaOctangula
{
public	function stellaOctangulaNo(\$k)
{
// Print all initial k stella octangula number
for (\$n = 0; \$n < \$k; ++\$n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
\$result = \$n * (2 * (\$n * \$n) - 1);

// Display calculated result
echo(" ".\$result);
}
}
}

function main()
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
main();``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````// Node JS program for
// Stella octangula number
class StellaOctangula
{
stellaOctangulaNo(k)
{
// Print all initial k stella octangula number
for (var n = 0; n < k; ++n)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
var result = n * (2 * (n * n) - 1);

// Display calculated result
process.stdout.write(" " + result);
}
}
}

function main()
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
main();``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````#  Python 3 program for
#  Stella octangula number
class StellaOctangula :
def stellaOctangulaNo(self, k) :
n = 0
#  Print all initial k stella octangula number
while (n < k) :
#    Formula
#    n(2n² - 1)

#  Calculate nth stella octangula number
result = n * (2 * (n * n) - 1)

#  Display calculated result
print(" ", result, end = "")
n += 1

def main() :
#  Stella octangula numbers are
#  —————————————————————————————————————————————
#   0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
#   1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
#   11646, 13699, 15980, 18501, 21274, 24311,
#   27624, 31225, 35126, 39339 ... etc

#   Test  k = 10

if __name__ == "__main__": main()``````

#### Output

``  0  1  14  51  124  245  426  679  1016  1449``
``````#  Ruby program for
#  Stella octangula number
class StellaOctangula
def stellaOctangulaNo(k)
n = 0
#  Print all initial k stella octangula number
while (n < k)
#    Formula
#    n(2n² - 1)

#  Calculate nth stella octangula number
result = n * (2 * (n * n) - 1)

#  Display calculated result
print(" ", result)
n += 1
end

end

end

def main()
#  Stella octangula numbers are
#  —————————————————————————————————————————————
#   0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
#   1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
#   11646, 13699, 15980, 18501, 21274, 24311,
#   27624, 31225, 35126, 39339 ... etc

#   Test  k = 10
end

main()``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````// Scala program for
// Stella octangula number
class StellaOctangula()
{
def stellaOctangulaNo(k: Int): Unit = {
var n: Int = 0;
// Print all initial k stella octangula number
while (n < k)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
var result: Int = n * (2 * (n * n) - 1);

// Display calculated result
print(" " + result);
n += 1;
}
}
}
object Main
{
def main(args: Array[String]): Unit = {
var task: StellaOctangula = new StellaOctangula();
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``
``````// Swift 4 program for
// Stella octangula number
class StellaOctangula
{
func stellaOctangulaNo(_ k: Int)
{
var n: Int = 0;
// Print all initial k stella octangula number
while (n < k)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
let result: Int = n * (2 * (n * n) - 1);

// Display calculated result
print(" ", result, terminator: "");
n += 1;
}
}
}
func main()
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}
main();``````

#### Output

``  0  1  14  51  124  245  426  679  1016  1449``
``````// Kotlin program for
// Stella octangula number
class StellaOctangula
{
fun stellaOctangulaNo(k: Int): Unit
{
var n: Int = 0;
// Print all initial k stella octangula number
while (n < k)
{
//   Formula
//   n(2n² - 1)

// Calculate nth stella octangula number
val result: Int = n * (2 * (n * n) - 1);

// Display calculated result
print(" " + result);
n += 1;
}
}
}
fun main(args: Array < String > ): Unit
{
// Stella octangula numbers are
// —————————————————————————————————————————————
//  0, 1, 14, 51, 124, 245, 426, 679, 1016, 1449,
//  1990, 2651, 3444, 4381, 5474, 6735, 8176, 9809,
//  11646, 13699, 15980, 18501, 21274, 24311,
//  27624, 31225, 35126, 39339 ... etc

//  Test  k = 10
}``````

#### Output

`` 0 1 14 51 124 245 426 679 1016 1449``

## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.