This is a continuation of a previous thread767-1535083.
My original thread is calculating the below @Scanline by:
String value = "6246300224479"
a) Each alternating character is multiplied by 2 and 1
(i.e. 6*2, 2*1, 4*2...)
b) All digits are then summed:
6*2=12 or 1+2 + 2*1 or 2 + 4*2 or 8...)
c) The sum of the above value = 59
d) The sum is divided by 10 and the remainder of 9 is deducted from 10 leaving a final value of 1.
stringvar x := {table.string};
numbervar i;
numbervar j := len(x);
stringvar array z;
numbervar p :=0;
for i := 1 to j do(
redim preserve z;
if remainder(i,2) = 1 then
z := totext(val(x)*2,"00") else
z := totext(val(x),"00");
p := p + sum([val(z[1]),val(z[2])]));
totext(abs(10 - val(right(totext(p,"0000"),1))),"0")
The above works great!
BUT, now I need a different group of multipliers.
The new alternating multiplier group is 7,5,3,2...
String value = "6246300224479"
a) Each alternating character is multiplied by 7,5,3 and 2
(i.e. 6*7, 2*5, 4*3...)
b) All digits are then summed:
(6*7=42 or 4+2) + (2*5=10 or 1+0) + (4*3=6 or 6) + (6*2=12 or 1+2) + (0*7=0 or 0) + (0*5=0 or 0)+...
c) The sum of the above value = 44
d) The sum is divided by 10 and the remainder of 4 is deducted from 10 leaving a final value of 6.
(if the remainder is 0, then the final value is 0)
Any help I can get is REALLY APPRECIATED!!!
My original thread is calculating the below @Scanline by:
String value = "6246300224479"
a) Each alternating character is multiplied by 2 and 1
(i.e. 6*2, 2*1, 4*2...)
b) All digits are then summed:
6*2=12 or 1+2 + 2*1 or 2 + 4*2 or 8...)
c) The sum of the above value = 59
d) The sum is divided by 10 and the remainder of 9 is deducted from 10 leaving a final value of 1.
stringvar x := {table.string};
numbervar i;
numbervar j := len(x);
stringvar array z;
numbervar p :=0;
for i := 1 to j do(
redim preserve z;
if remainder(i,2) = 1 then
z := totext(val(x)*2,"00") else
z := totext(val(x),"00");
p := p + sum([val(z[1]),val(z[2])]));
totext(abs(10 - val(right(totext(p,"0000"),1))),"0")
The above works great!
BUT, now I need a different group of multipliers.
The new alternating multiplier group is 7,5,3,2...
String value = "6246300224479"
a) Each alternating character is multiplied by 7,5,3 and 2
(i.e. 6*7, 2*5, 4*3...)
b) All digits are then summed:
(6*7=42 or 4+2) + (2*5=10 or 1+0) + (4*3=6 or 6) + (6*2=12 or 1+2) + (0*7=0 or 0) + (0*5=0 or 0)+...
c) The sum of the above value = 44
d) The sum is divided by 10 and the remainder of 4 is deducted from 10 leaving a final value of 6.
(if the remainder is 0, then the final value is 0)
Any help I can get is REALLY APPRECIATED!!!