Reaching a divisor function with Macro Scheduler [solved]

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

Reaching a divisor function with Macro Scheduler [solved]

Post by ABIVEN » Fri Jul 06, 2018 6:31 am

Macro Scheduler may be very helpful for some Math Calculations
But I , absolutely , need to use a DIVISOR function which retrieves the smallest divisor
Exemple DIVISOR (77) =7 or DIVISOR (95334677) =1831

Do you know a way (even an indirect way) to reach this function with Macro Scheduler ?

Thanks
Last edited by ABIVEN on Sat Jul 07, 2018 8:31 am, edited 1 time in total.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Reaching a divisor function with Macro Scheduler

Post by JRL » Sat Jul 07, 2018 5:03 am

Don't truly know what you're looking for but this gives the same answer as your example.

Code: Select all

Let>value=95334677

Let>kk=1

Repeat>kk
  Add>kk,1
  Let>res={%value%/%kk%}
  Separate>res,.,item
  If>item_Count<2
    Let>ans=kk
    Let>kk=done
  EndIf
Until>kk=done

mdl>ans

ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

Re: Reaching a divisor function with Macro Scheduler

Post by ABIVEN » Sat Jul 07, 2018 8:30 am

Many thanks JRL for this swift reply

In fact I have to get all the divisors of a number ; with a lot of number to deal.
Your macro works very well for that purpose but I am very concerned by the calculation time

I mark this topic [solved] and I'II explain it better later

Regards

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts