User Tools

Site Tools


Sidebar

Home



Knowledge Base


Guides & Tutorials

Projects

Samples

  G-Code
   Square
   Arcs
   Mickey
   Arrow
   Bear
   Ball In Cage

  Dialogs
   Square
   Rounded Square
   Guess The Number

  O-Words
   Polygon

  Subprocedures
   Lissajous

   Lissajous (sub..endsub..call)
   Lissajous (call..sub..endsub)

   Lissajous (exec..O..M99)

   Lissajous (G65)
   Lissajous (G65 with GOTO)

   Palindrome
   PrimeFactors
   Fibonacci

  Splines
   Butterfly

  G06
   arrchr

  Dynamic
   Clock
   DateTime

  Python
   Lissajous Python

  3D Models
   3D CNC
   3dModel_TableA.txt

  Notepad++ Plugin
   Examples


kb:samples:primefactors

PrimeFactors

O<PrimeFactors> call [12246] ;2 3 13 157
M2

O<PrimeFactors> sub
	#<n> = #1

	O<wh> while [[#<n> MOD 2] EQ 0]
		(print,2)
		#<n> = [#<n>/2]
	O<wh> endwhile

	#<i> = 3
	O<wh> while [#<i> LE sqrt[#<n>]]
		O<wh2> while [[#<n> MOD #<i>] EQ 0]
			(print,#<i,0>)
			#<n> = [#<n>/#<i>]
		O<wh2> endwhile
		#<i> = [#<i> + 2]
	O<wh> endwhile
 
	O<if> if [#<n> GT 2]
		(print,#<n,0>)
	O<if> endif
O<PrimeFactors> endsub
kb/samples/primefactors.txt · Last modified: 2024/04/07 22:43 by andrej

Page Tools