Sum of each element raised to ( prime | Java implementation of the approach ; Function to return the required sum ; Driver code
public class GFG { public static int getSum ( int arr [ ] , int p ) { return arr . length ; } public static void main ( String [ ] args ) { int arr [ ] = { 5 , 6 , 8 } ; int p = 7 ; System . out . print ( getSum ( arr , p ) ) ; } }