Ordered number thread
category: general [glöplog]
nine
ten
nine
ten
nine
{(1,42),(2,84),(2,6),(3,9)}
eleven?
seven!
null
NIL
∅
quisten: here you go:
#include "windows.h"
#include <iostream>
using namespace std;
int main()
{
unsigned int n = 1;
for ( int i = 0; i < 5; i++)
{
std::cout << "\n n = " << n;
n*=n+1; // #*=#+1 while # = number n
std::cout << "\n n*=n+1 -> " << n << "\n";
}
do {} while ( !GetAsyncKeyState(VK_ESCAPE) );
return 0;
}
should compile! too bad pouet doesnt show tabs ! looks a bit messy like that!
#include "windows.h"
#include <iostream>
using namespace std;
int main()
{
unsigned int n = 1;
for ( int i = 0; i < 5; i++)
{
std::cout << "\n n = " << n;
n*=n+1; // #*=#+1 while # = number n
std::cout << "\n n*=n+1 -> " << n << "\n";
}
do {} while ( !GetAsyncKeyState(VK_ESCAPE) );
return 0;
}
should compile! too bad pouet doesnt show tabs ! looks a bit messy like that!
cOcOOn:
n*n+n is the formula n*n+1
1*1+1 = 2 2
2*2+2 =6 5
6*6+6 = 42 26
easy
n*n+n is the formula n*n+1
1*1+1 = 2 2
2*2+2 =6 5
6*6+6 = 42 26
easy
oh, tab problem yea
ok,got you,guess we both are right somehow then!
exchange
n*=n+1;
with
unsigned int m = n;
n*=n;
n+=m;
and its what you said!
still codewise it would be shorter my way!
still your normal math-formula n*n+n is smaller than my code! (n*=n+1 is one more char!)
haha! was still fun thinking about it and all,thanx :)
exchange
n*=n+1;
with
unsigned int m = n;
n*=n;
n+=m;
and its what you said!
still codewise it would be shorter my way!
still your normal math-formula n*n+n is smaller than my code! (n*=n+1 is one more char!)
haha! was still fun thinking about it and all,thanx :)
cocoon: my bad :) i only saw your first attempt: #*#+1 which is very wrong.
yeah,i´m used to use the "#" as a mark for the word "number" ,haha
ok,by now it means preprocessor to me,haha
got used to it thru 68k-asm...there "#10" is decimal and "#$10" is hexadecimal,dunno if thats still the same nowadays on pcs.
ok,by now it means preprocessor to me,haha
got used to it thru 68k-asm...there "#10" is decimal and "#$10" is hexadecimal,dunno if thats still the same nowadays on pcs.
anyways,back to ordered numbers
0
0
-1
still very kewl how the 42 is the 3rd iteration in this formula,while we all live in the 3rd dimension and we all know what the robots answer was in "The Hitchhiker's Guide to the Galaxy",haha
don´t panic!
don´t panic!