Euler3

by enecre forked from Euler5 (diff: 11)
♥0 | Line 29 | Modified 2010-10-07 08:52:42 | MIT License
play

ActionScript3 source code

/**
 * Copyright enecre ( http://wonderfl.net/user/enecre )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/eshk
 */

// forked from enecre's forked from: Euler6
// forked from enecre's Euler6
// forked from enecre's Euler2
package {
    import flash.text.TextField;
    import flash.display.Sprite;
    public class Euler extends Sprite {
        private var tf:TextField = new TextField();
        public function Euler() {
            // write as3 code here..
            tf.height = 465;
            tf.width = 465;
            addChild(tf);
            init();
        }
        
        public function init():void{
            var ans:uint = 0;
            var q:uint = 600851475143;
            tr(q);
            for(var i:uint = 0; i < 775150; i++){
                if(q % i == 0){
                    ans = i;
                    q = uint(q / i);
                }
            }
            tr(ans, q);
            //tr();
        }

        
        private function tr(...o:Array):void{
            tf.appendText(o + "\n");
            tf.scrollV = tf.maxScrollV;
        }

    }
}

Forked