function that manually calculates n ^ n and then removes digits until k digits remain
< ? php function firstkdigits ( $ n , $ k ) { $ product = 1 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ product *= $ n ;