public static double fun1 ( int v , int k ) {
  double x = Math . log10 ( ( double ) v ) / Math . log10 ( ( double ) k ) ;
  int end = ( int ) ( ( x == ( int ) x ) ? x + 1 : ( int ) ( Math . ceil ( x ) ) ) ;
  int res = 0 ;
  for ( int i = 0 ;
  i < end ;
  i ++ ) {
    res += v / ( int ) ( Math . pow ( k , i ) ) ;
  }
  return res ;
}

public static double fun1 ( int v , int k ) { double x = Math . log10 ( ( double ) v ) / Math . log10 ( ( double ) k ) ; int end = ( int ) ( ( x == ( int ) x ) ? x + 1 : ( int ) ( Math . ceil ( x ) ) ) ; int res = 0 ; for ( int i = 0 ; i < end ; i ++ ) { res += v / ( int ) ( Math . pow ( k , i ) ) ; } return res ; }
(method_declaration (modifiers) type: (floating_point_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (floating_point_type) value: (identifier)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (cast_expression type: (floating_point_type) value: (identifier))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (parenthesized_expression (ternary_expression condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))) consequence: (binary_expression left: (identifier) right: (decimal_integer_literal)) alternative: (cast_expression type: (integral_type) value: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier)))))))))) (return_statement (identifier))))