# pouët.net

Go to bottom

category: general [glöplog]
nine
added on the 2008-11-24 19:04:02 by rac
ten
added on the 2008-11-24 19:10:21 by pera
nine
added on the 2008-11-24 19:14:23 by kusma
ten
added on the 2008-11-24 19:15:00 by quisten
nine
{(1,42),(2,84),(2,6),(3,9)}
added on the 2008-11-24 19:20:39 by button
eleven?
seven!
added on the 2008-11-24 19:59:18 by Baz
null
added on the 2008-11-24 20:01:33 by v3nom
NIL
added on the 2008-11-24 20:08:15 by v3nom
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!
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

added on the 2008-11-24 22:50:43 by quisten
oh, tab problem yea
added on the 2008-11-24 22:51:24 by quisten
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 :)
cocoon: my bad :) i only saw your first attempt: #*#+1 which is very wrong.
added on the 2008-11-24 23:43:01 by quisten
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.
anyways,back to ordered numbers

0
-1
added on the 2008-11-25 08:46:19 by Baz
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!