Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#C++ (削除) 99 (削除ここまで)(削除) 81 (削除ここまで)(削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;while(i<x)a[i++]=a[--i]+(++i)+i+1;return a;}

C++ (削除) 99 (削除ここまで)(削除) 81 (削除ここまで)(削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78

int* f(int x){int a[x],i=1;a[0]=1;while(i<x)a[i++]=a[--i]+(++i)+i+1;return a;} 

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

#C++ (削除) 99 (削除ここまで)(削除) 81 (削除ここまで)(削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;while(i<x)a[i++]=a[--i]+(++i)+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

C++ (削除) 99 (削除ここまで)(削除) 81 (削除ここまで)(削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78

int* f(int x){int a[x],i=1;a[0]=1;while(i<x)a[i++]=a[--i]+(++i)+i+1;return a;} 

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

edited body
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) (削除) 78 (削除ここまで) (削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;fori=1;a[0]=1;while(;i<x;i<x)a[i++]=a[--i]+(++i)+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) (削除) 78 (削除ここまで) (削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;for(;i<x;)a[i++]=a[--i]+(++i)+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) (削除) 78 (削除ここまで) (削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;while(i<x)a[i++]=a[--i]+(++i)+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

added 37 characters in body
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) 78
(削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;for(;i<x;){a[i++]=a[--i]+(++i)+i+1;}return+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) 78
int* f(int x){int a[x],i=1;a[0]=1;for(;i<x;){a[i++]=a[--i]+(++i)+i+1;}return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

#C++ (削除) 99 (削除ここまで) (削除) 81 (削除ここまで) (削除) 78 (削除ここまで)(削除) 80 (削除ここまで) 78 int* f(int x){int a[x],i=1;a[0]=1;for(;i<x;)a[i++]=a[--i]+(++i)+i+1;return a;}

my first try in code-golf

this code is based on
a = 2 x n - 1
where n is term count and a is n th term in the following series
1, 3, 5, 9, 11, 13, .....
sum of first 2 terms = 2 squared

sum of first 3 terms = 3 squared
and so on...

added 4 characters in body
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29
Loading
added 17 characters in body
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29
Loading
deleted 4 characters in body
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29
Loading
Source Link
Mukul Kumar
  • 2.7k
  • 2
  • 21
  • 29
Loading

AltStyle によって変換されたページ (->オリジナル) /