FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smallbasic.github.io/samples/node/1332.bas at master · smallbasic/smallbasic.github.io · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
smallbasic
/
smallbasic.github.io
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
4
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1332.bas
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (39 loc) · 770 Bytes
Breadcrumbs
smallbasic.github.io
/
samples
/
node
/
1332.bas
Copy path
File metadata and controls
41 lines (39 loc) · 770 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
REM SB Factor.bas for SmallBASIC 0.12.0 05/11/2015 MGA/B+ for On-line Samples
'
a couple of tweaks in first couple of lines of the Factor.bas code
'
in my FTLK download samples gets this handy math code up and running
s$=
"
^
"
n$=
"
"
while
1
INPUT
"
Enter a number to factor, <2 quits
"
;x
IF
x
<
2
THEN
EXIT
x0
=
x
f$=
"
"
f
=
2
p
=
0
WHILE
x
>
1
tmp
=
x
/
f
if
tmp
=
int
(
tmp
)
THEN
p
=
p
+
1
x
=
tmp
ELSE
IF
p
>
0
THEN
f$=
f
$+
str
$(
f
)
IF
p
>
1
THEN
f$=
f
$+
s
$+
str
$(
p
)+
n
$
f$=
f
$+
"
x
"
p
=
0
ENDIF
'
the next line is cool!
f
=
f
+
1
+(
f
>
2
)
IF
f
>
sqr
(
x
)
THEN
f
=
x
ENDIF
WEND
f$=
f
$+
str
$(
f
)
IF
p
=
1
THEN
IF
f
=
x0
THEN
f$=
f
$+
"
is prime
"
ENDIF
ELSE
f$=
f
$+
s
$+
str
$(
p
)+
n
$
ENDIF
PRINT
f$
wend
Back
|
FazBrowse Home
|
New Git URL