<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Python to FF example</title><link>https://sourceforge.net/p/flashforth/wiki/Python%2520to%2520FF%2520example/</link><description>Recent changes to Python to FF example</description><atom:link href="https://sourceforge.net/p/flashforth/wiki/Python%20to%20FF%20example/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 13 Jan 2022 06:40:44 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/flashforth/wiki/Python%20to%20FF%20example/feed" rel="self" type="application/rss+xml"/><item><title>Python to FF example modified by Mikael Nordman</title><link>https://sourceforge.net/p/flashforth/wiki/Python%2520to%2520FF%2520example/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,3 +1,4 @@
+~~~
 \ ************
 \ 
 \    Filename:      prime_factors.txt 
@@ -69,3 +70,4 @@
    ;

 ram hex 
+~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mikael Nordman</dc:creator><pubDate>Thu, 13 Jan 2022 06:40:44 -0000</pubDate><guid>https://sourceforge.net21fc038801bb8504b57a1ec913e65161120190ae</guid></item><item><title>Python to FF example modified by Pete Zawasky</title><link>https://sourceforge.net/p/flashforth/wiki/Python%2520to%2520FF%2520example/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;\ &lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;br/&gt;
\ &lt;br/&gt;
\    Filename:      prime_factors.txt &lt;br/&gt;
\    FlashForth:    5.0 &lt;br/&gt;
\    MCU            PIC18F6527 &lt;br/&gt;
\    Application:   Eval Board &lt;br/&gt;
\ &lt;br/&gt;
\    Author:        Pete Zawasky &lt;br/&gt;
\    Created:       06:51 PM 01/05/2020   ppz &lt;br/&gt;
\    Last Edit      02:58 PM 01/12/2022   ppz&lt;br/&gt;
\&lt;br/&gt;
\ &lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;br/&gt;
\  FlashForth is licensed acording to the GNU General Public License &lt;br/&gt;
\ &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;&lt;br/&gt;
\ This code is distributed in the hope that it will be useful,&lt;br/&gt;
\ but WITHOUT ANY WARRANTY; without even the implied warranty&lt;br/&gt;
\ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.&lt;br/&gt;
\ &lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;strong&gt;&lt;br/&gt;
\ Prime Factorization using FlashForth.&lt;br/&gt;
\ Compare to python code calculating prime factors using recursion.&lt;br/&gt;
\&lt;br/&gt;
\ #re www.wired.com/story/how-to-make-a-tree-with-fractals/&lt;br/&gt;
\ #this is the function&lt;br/&gt;
\ def pfact(n):&lt;br/&gt;
\     if n&amp;gt;1:&lt;br/&gt;
\         i=2&lt;br/&gt;
\         while n % i !=0:&lt;br/&gt;
\             print(n,",",i,",",n//i,",",n%i)&lt;br/&gt;
\             i=i+1&lt;br/&gt;
\         print(i)&lt;br/&gt;
\        #function calling itself -- recursion&lt;br/&gt;
\         pfact(n/i)&lt;br/&gt;
\     else:&lt;br/&gt;
\         print("Finished")&lt;br/&gt;
\        &lt;br/&gt;
\ #change this number for fun&lt;br/&gt;
\ pfact(14)&lt;br/&gt;
\ #pfact(1234533)&lt;br/&gt;
\ &lt;strong&gt;&lt;em&gt;*&lt;/em&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;-pfact&lt;br/&gt;
marker -pfact&lt;/p&gt;
&lt;p&gt;decimal  ram&lt;/p&gt;
&lt;p&gt;\ variables&lt;br/&gt;
variable N&lt;br/&gt;
variable I&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;\ Print prime factors of the integer 16-bit u.&lt;/dt&gt;
&lt;dt&gt;\ Unsigned integers preferred.&lt;/dt&gt;
&lt;dt&gt;\&lt;/dt&gt;
&lt;dd&gt;pfact   ( u -- )&lt;br/&gt;
   N !&lt;br/&gt;
   begin&lt;br/&gt;
     N @ 1 u&amp;gt;&lt;br/&gt;
   while              \ u&amp;gt;1&lt;br/&gt;
     2 I !&lt;br/&gt;
     begin&lt;br/&gt;
       N @ I @  u/mod drop 0 &amp;lt;&amp;gt;&lt;br/&gt;
     while              \ N/I=rem not 0&lt;br/&gt;
       cr N @ dup u.  I @ dup u.  u/mod u.  u.  \ print N I N/I rem&lt;br/&gt;
       1 I +!                                   \ add 1 to I &lt;br/&gt;
     repeat&lt;br/&gt;
     cr I @ u.          \ print I&lt;br/&gt;
     N @ I @ u/  N !    \ u=u/I&lt;br/&gt;
   repeat&lt;br/&gt;
   cr ." Finished"&lt;br/&gt;
   ;               &lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;ram hex &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Pete Zawasky</dc:creator><pubDate>Wed, 12 Jan 2022 20:16:12 -0000</pubDate><guid>https://sourceforge.net4aa8d26bd23e95e0b2e1c7d97775f61a4c34e350</guid></item></channel></rss>