quickbasic fibonacci sequence

pwnt by pat
10+ year member

Pat for Prez 2024 - vote!
I am bored at school, so I decided to write a program listing the prime number sequence to a given amount. It works quite well, except the ouput I'm given. I haven't programed with QB for five or six years, so I'm a little rusty. what I want to do is get the output text file in comma seperated value form. Currently, it puts each value on it's own line. If anyone knows anything, please, feel free to lend me a hand.

I just realized it's not the fibonacci sequence, it's the sequence of numbers only evenly divisible by themselves and 1, prime numbers.

Here's the code:

CLSOPEN "fib.txt" FOR OUTPUT AS #1

PRINT "Number of sequence:"

INPUT q

x = 1

z = 0

DIM seq(1 TO q)

DO

FOR i = 2 TO 5

IF x / i = x \ i THEN

z = 1

END IF

IF (x = 2 OR x = 3 OR x = 5) THEN z = 0

NEXT i

IF z = 0 THEN seq(x) = x

x = x + 1

z = 0

LOOP UNTIL x = (q + 1)

FOR i = 1 TO q

IF seq(i) 0 THEN

PRINT seq(i)

WRITE #1, seq(i)

END IF

NEXT

END
 
Well, the thing is I can get it to write var$ "string". Because of the length of the array, the values have to be called with a for i loop. Then, each write sequence creates a new line.

I know there HAS to be a way to get them on the same line....

I wrote the fibonacci program. I'm having a problem with running out of program memory. the 2+million places is certainly not enough room.

 
i think you need to seperate the centrifugal force from the gravitational pull quotient because the output seems to contradict what the input's encryption is trying to subtract from visual borland's C++ activator window. and i think you're running out of program memory because your pro-fibonacci flux capacitor is grounded to the motherboard's core chassis. try switching the two to see if you get a better script result from the output. if that doesn't work, i think it may have something to do with the pulse width modulator that regulates the coding in windows. and i see that at the end you have:

FOR i = 1 TO qIF seq(i) 0 THEN

PRINT seq(i)

WRITE #1, seq(i)

END IF

NEXT
the end quotient is going to result in a glitched hyperdrive crash failure. i suggest yo change WRITE #1, seq(i) to WRITE #1, seq(i)+seq(g-r^2) so that it doesn't debug itself. debugging itself can also cause you to run out of prgram memory (due to the cycles of end code vs. start code which causes the program to "loop" itself) like u mentioned. in conclusion, what the hell r u talking about.

 
i think you need to seperate the centrifugal force from the gravitational pull quotient because the output seems to contradict what the input's encryption is trying to subtract from visual borland's C++ activator window. and i think you're running out of program memory because your pro-fibonacci flux capacitor is grounded to the motherboard's core chassis. try switching the two to see if you get a better script result from the output. if that doesn't work, i think it may have something to do with the pulse width modulator that regulates the coding in windows. and i see that at the end you have:


the end quotient is going to result in a glitched hyperdrive crash failure. i suggest yo change WRITE #1, seq(i) to WRITE #1, seq(i)+seq(g-r^2) so that it doesn't debug itself. debugging itself can also cause you to run out of prgram memory (due to the cycles of end code vs. start code which causes the program to "loop" itself) like u mentioned. in conclusion, what the hell r u talking about.

do you know how not to be an ***? how many times does it take being banned before you stop being stupid?

 
noob with a rs (gogo grammer): get the **** out

raven, the problem with one big variable is that even with the "long" description, each variable (even in an array) is limited to like 2.2million and some odd places. With prime, it's okay, but with fibonacci you are essentially multiplying the last value by 1.5 each time. I also can't seem to get the long descriptor to work with the array length for the "prime" program. I can get rid of the array altogether but... I dunno. I'm waiting for my newest version of Prime to finish calculating now... up to number 123456789.

Here's what I have now

CLS

DIM q AS LONG

DIM i AS LONG

PRINT "Number of sequence"

INPUT q

DIM seq(0 TO q + 1) AS LONG

seq(1) = 1

FOR i = 2 TO (1 + q)

seq(i) = seq(i - 2) + seq(i - 1)

NEXT

FOR i = 0 TO (q + 1)

PRINT seq(i)

NEXT
I'll post prime when it's done compiling.

 
The only thing I could think of then would be to store the output on a hard file (not memory) which is written to after every loop. Then adjust the output through some string replacement. It'd be a real jury-rig job, but it'd work. =\

 
the spelling of the letter 'R' is 'AHR' //content.invisioncic.com/y282845/emoticons/fyi.gif.9f1f679348da7204ce960cfc74bca8e0.gif
Never noticed that. Still, gramatically incorrect the way it's listed...

My prime number program just gave me a 317mb 123.25million line long text file. I am waiting for my computer to process it.... heh

 
do you know how not to be an ***? how many times does it take being banned before you stop being stupid?
sorry, i was just trying to appeal to the people with a sense of humor. no disrespecting was done whatsover. i was practicing using humor as a writing tool like i was taught in college. don't blame me, blame education.

noob with a rs (gogo grammer)
please stick to coding and do not attempt to pursue any literacy-related careers. thank you.

 
Activity
No one is currently typing a reply...

About this thread

pwnt by pat

10+ year member
Pat for Prez 2024 - vote!
Thread starter
pwnt by pat
Joined
Location
Pa
Start date
Participants
Who Replied
Replies
18
Views
393
Last reply date
Last reply from
pwnt by pat
design.jpeg

WNCTracker

    May 22, 2026
  • 0
  • 0
IMG_2118.jpeg

WNCTracker

    May 22, 2026
  • 0
  • 0

New threads

Top