I am attempting to create this app (Calculating the highest prime factor of 
a given integer):

function hpf() {
var x = SpreadsheetApp.getActiveSheet();
var p = 0;
y=int(sqrt(x)+1)
   
hiprfa:

    
for (i=y; i>0; i--) {
    if (y % i == 0) 
    {
        for (j=i-1; j>1; j--)
        {
            if (i % j == 0) { f = j; continue hiprfa; }
        }
        p = i;
        break;
    }
}
return p;
}

It keeps saying that 'int' is undefined, I know I am missing something 
simple in defining y.  If I replace y with x in 'for (i=y; i>0; i--) {' it 
returns 0.  Something else is wrong.

Many thanks


John

-- 
You received this message because you are subscribed to the Google Groups 
"Google Spreadsheets API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-spreadsheets-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to