Jump to content



Photo
- - - - -

Decomposition Of A Number Into Prime Factors


  • Please log in to reply
17 replies to this topic

#1 shugotenshi

shugotenshi

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio FX 1.0

Posted 23 October 2004 - 12:20 AM

i'm new here, and new to programming on calculators, so i need some help. :)
the more i try the more i mess up this hellava simple program... decomposing a number into prime factors. :banghead: :profanity:

this is my code as is (if you see any bugs please tell me what to correct :greengrin:):

ClrText :newline:
"INSERT NUMBER" ?->A :newline:
Do :newline:
While Frac (A/B)=0 :newline:
B :theta:
A/B->A :newline:
WhileEnd :newline:
If B=2 :newline:
Then 3->B :newline:
Else B+2->B :newline:
IfEnd :newline:
LpWhile B<A :newline:
"END"

thanks! ^_^

#2 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 23 October 2004 - 12:25 PM

You should add a 2->B at the beginning :)

#3 Bija

Bija

    Casio Fan

  • Members
  • PipPip
  • 44 posts

  • Calculators:
    Graph 25, Graph 100+ 1.05

Posted 23 October 2004 - 12:35 PM

i tested it and it works fine except 2 things :
you should put 2->B at the beginning of the program
you should do LpWhile B<=A (<= means the symbol for inferior or equal) instead of LpWhile B<A because if B=A, B is a factor of A

then it works fine!
good continuation !

#4 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 23 October 2004 - 12:40 PM

you should do B<=sqrt(A), and display A at the end if A != 1 because if X is a prime factor of A, X can't be > sqrt(A) except if A is prime

#5 shugotenshi

shugotenshi

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio FX 1.0

Posted 23 October 2004 - 01:34 PM

thanks guys!
you were a great help :D

#6 shugotenshi

shugotenshi

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio FX 1.0

Posted 25 October 2004 - 08:45 AM

Sorry about double posting, but i didnt want to start a new thread.
You guys really helped me out back there! thanks a bunch! :D
Im having trouble passing this same program to the Casio CFX-9850 GB Plus.
I can't transfer it by cable, but i have rebuilt it almost intirely on that calculator using the same code. All that's missing is how the "Frac" command.
And i can't find it for the life of me XD
Does anyone know if that model has the "Frac" command at all? If so how do i find it? Will the program run once i've input it?

#7 huhn_m

huhn_m

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1957 posts
  • Gender:Male
  • Location:Germany / Dresden
  • Interests:Assembler(!!!)
    Computers and Programming
    Operating Systems
    Programmable Calculators
    Maths and everything arround it

  • Calculators:
    FX-82SX / AFX 2.0+ (ROM 1.03) / FX 1.0+ (ROM 1.03)

Posted 25 October 2004 - 09:18 AM

it has. It is somewhere udner OPT->NUM

You can'T transfer from FX 1.0+ to CFX since they have different protocolls. However there is a possibility to transfer from CFX to FX 1.0

#8 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 25 October 2004 - 05:25 PM

if you really don't have Frac you can use
Frac X = X - Int X

#9 Bija

Bija

    Casio Fan

  • Members
  • PipPip
  • 44 posts

  • Calculators:
    Graph 25, Graph 100+ 1.05

Posted 25 October 2004 - 06:01 PM

and if he hasn't Int ?
because Int et Frac are in the same menu ...

#10 Overlord

Overlord

    Casio Technician

  • Moderator
  • PipPipPipPipPipPip
  • 355 posts
  • Gender:Male
  • Location:Brussels - Belgium
  • Interests:Math Researcher

  • Calculators:
    My head - C300 OS 3.00 - G100 Rom 1.02 - G65 - G60 - G25

Posted 25 October 2004 - 07:57 PM

11->B
While B>=0
While X>=10^B
X-10^B=>X
WhileEnd
B-1=>B
WhileEnd
X
:P:P:p:p ?

#11 octobclrnts

octobclrnts

    Casio Freak

  • Members
  • PipPipPipPip
  • 145 posts
  • Location:Pennsylvania, United States
  • Interests:Computers<br />Programming languages<br />Artificial Intelligence<br />Music (clarinet)

  • Calculators:
    Casio CFX 9850GB Plus
    Ti-89 Titanium

Posted 30 October 2004 - 05:32 PM

No, No. Frac and Int are definately both there (I just checked to make sure). They are under OPTN->NUM just as huh_m said.

#12 DarkDead

DarkDead

    Newbie

  • Members
  • Pip
  • 23 posts
  • Location:Portugal

  • Calculators:
    Casio fx-7400G | Casio fx-9860G SD

Posted 11 April 2007 - 11:57 PM

Hi. A friend of mine said he once could decompose a number in the RUN.MAT menu (menu 1) on a 9860. I've searched the manual and I only found a program to do this. Is that possible and does anyone know how to do it?

#13 Guest_volkan_*

Guest_volkan_*
  • Guests

Posted 23 January 2008 - 08:29 PM

How can I make a question mark and > or < on my casio fx7400Gplus?

#14 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 23 January 2008 - 10:50 PM

Try looking here: http://www.brianhetr...io/ikeyseq.html

#15 Scott

Scott

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Wellington, New Zealand
  • Interests:I like programing.

  • Calculators:
    Cfx-9750 GA+ (AKA Cfx-9750 G+)
    Brain (a little faulty)
    Some one dollar piece of *****

Posted 12 June 2009 - 07:23 AM

Hey all, I had a guy make me a program that could work out whether a number is a prime or not. Its usefull but really slow when it comes to larger numbers. If someone could tell me a different format on how tomake this quicker that would be usefull.

[codebox]"Number"?->A
2->B
While Frac (A/B)\=0
B+1=B
If B=A
Then "prime"
Stop
Ifend
WhileEnd
"Not prime"[/codebox]
This is very simalar but slightly different so all i want to know is how to make it faster.
Cheers

#16 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1564 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Alternative states of consciousness, programming, making things work the best they possibly can.

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 12 June 2009 - 08:43 PM

I've made such a program a long time ago, it's a lot more optimized than this one, it's in the filsharing: http://www.casiocalc...s#prime_numbers

#17 Scott

Scott

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Wellington, New Zealand
  • Interests:I like programing.

  • Calculators:
    Cfx-9750 GA+ (AKA Cfx-9750 G+)
    Brain (a little faulty)
    Some one dollar piece of *****

Posted 13 June 2009 - 09:00 AM

I've made such a program a long time ago, it's a lot more optimized than this one, it's in the filsharing: http://www.casiocalc...s#prime_numbers

Thanks I checked it out but as I dont have a cable I really dont want to type it out by hand. How can you start a new topic, Im stuck?

#18 Scott

Scott

    Newbie

  • Members
  • Pip
  • 16 posts
  • Gender:Male
  • Location:Wellington, New Zealand
  • Interests:I like programing.

  • Calculators:
    Cfx-9750 GA+ (AKA Cfx-9750 G+)
    Brain (a little faulty)
    Some one dollar piece of *****

Posted 13 June 2009 - 09:22 AM

Ha I found out how to post a topic, ive got a question up there i would want answered




3 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users


    Google (1)