[SWF(width = 500, height = 500)]
var txt:TextField = TextField(addChild(new TextField()));
txt.defaultTextFormat = new TextFormat("_sans", 4);
txt.width = stage.stageWidth;
txt.height = stage.stageHeight+4;
txt.z = -1;
txt.x = stage.stageWidth
txt.rotation = 90;
var count:int = 0;
addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event):void{
count++;
txt.appendText(triangular(count).toString(2) + "n");
txt.scrollV= txt.maxScrollV;
}
function triangular(n:int):int{
return (n * (n + 1)) / 2;
}
Calculate some triangular numbers… (n * (n + 1)) / 2….