School themes from USSR and EurAsia
#11
@JRACE welcome back home and nice to meet you. Your experience will likely be an asset when you participate here, I look forward to it.
b = b + ...
Reply
#12
Fibonacci Formula from Russia & EurAsia

[Image: FiboFormula.png]
can everyone see? image 8 KB

Code: (Select All)
Open "FiboFormula.txt" For Output As #1 ' optional
For i = 1 To 36 ' Russian FiboFormula.bas
    f = (1/Sqr(5))*(((1+Sqr(5))/2)^i-((1-Sqr(5))/2)^i)
    Print i, f
    Print #1, i, f ' optional
Next: End

Fibonacci Sequence Infinity

Code: (Select All)
DIM F(80) AS DOUBLE 'FibRus.bas
F(1) = 1: F(2) = 1
OPEN "FibRus.txt" FOR OUTPUT AS #2 ' optional
FOR i = 3 TO 80
    F(i) = F(i-1)+F(i-2)
NEXT i

FOR i = 1 TO 80
    f$ = STR$(F(i)): LF = 22 - LEN(f$)
    n$ = ""
    FOR j = 1 TO LF: n$ = " " + n$: NEXT
    f$ = n$ + f$
    PRINT i, f$: PRINT #2, i, f$ ' optional
NEXT i

Code: (Select All)
1                                 1
2                                 1
3                                 2
4                                 3
5                                 5
6                                 8
7                                13
...
24                            46368
25                            75025
26                           121393
...
76                 3416454622906707
77                 5527939700884757
78                 8944394323791464
79            1.447233402467622D+16

qb64 qbasic quickbasic
= (1/sqr(5))*(((1+sqr(5))/2)^N-((1-sqr(5))/2)^N)

excel & Python
= (1/Sqrt(5))*(((1+Sqrt(5))/2)^N-((1-Sqrt(5))/2)^N)
= (1/КОРЕНЬ(5))*(((1+КОРЕНЬ(5))/2)^B3-((1-КОРЕНЬ(5))/2)^B3)

C C+ C++ C# C@#$%&
= (1/Math.Sqrt(5))*(((1+Math.Sqrt(5))/2)^N-((1-Math.Sqrt(5))/2)^N)

[Image: Fibo-Formula.png]
image 8 KB
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply
#13
I just saw that you get Fibonacci and a whole lot of other cool stuff from "Number Walls."

https://www.youtube.com/watch?v=NO1_-qptr6c
b = b + ...
Reply
#14
(05-02-2022, 12:49 PM)DANILIN Wrote: I am currently a PeaceMaker

I applied to Ministries of RF and to deputies
and received answers and notifications

But I don't write about political topics anywhere
so that my appeals to authorities are not discussed

And I recommend 2020 movie: TeNeT

Flagimation: 137 kB

[Image: attachment.php?aid=237]

That flag proves Americans are better at Tic-Tac-Toe.

Trump 2024!

Pete Big Grin
Reply
#15
(09-02-2022, 07:07 PM)bplus Wrote: I just saw that you get Fibonacci and a whole lot of other cool stuff from "Number Walls."

https://www.youtube.com/watch?v=NO1_-qptr6c
thanks bplus, number walls are interesting and intriguing
Reply
#16
bplus, it would be interesting to have a program that would make it easy to explore sequences using the number wall system, I envision a graphic program where you could enter a sequence and you could either have the program run through the process or you would select 1 of 3 cursors, cross, big cross or horse shoe and then move the cursor on the sequence and click to have the program supply the missing number, it would also be useful if the program allowed you to click&drag to select say a square of numbers and the program would report whether the selected square's determinant is 0 or not, this is just for starters
Reply
#17
I sometimes wonder why they call them cans of worms... and not barrels. ???

Pete
Reply
#18
(11-08-2022, 03:19 PM)Jack Wrote: bplus, it would be interesting to have a program that would make it easy to explore sequences using the number wall system, I envision a graphic program where you could enter a sequence and you could either have the program run through the process or you would select 1 of 3 cursors, cross, big cross or horse shoe and then move the cursor on the sequence and click to have the program supply the missing number, it would also be useful if the program allowed you to click&drag to select say a square of numbers and the program would report whether the selected square's determinant is 0 or not, this is just for starters

(11-08-2022, 03:34 PM)Pete Wrote: I sometimes wonder why they call them cans of worms... and not barrels. ???

Pete

I almost suggested to get a thread but what had me slightly put off is that these things are infinite in each direction like game of life, keeps expanding... like off topic walls of worms ;-))
b = b + ...
Reply
#19
(11-08-2022, 03:47 PM)bplus Wrote:
(11-08-2022, 03:19 PM)Jack Wrote: bplus, it would be interesting to have a program that would make it easy to explore sequences using the number wall system, I envision a graphic program where you could enter a sequence and you could either have the program run through the process or you would select 1 of 3 cursors, cross, big cross or horse shoe and then move the cursor on the sequence and click to have the program supply the missing number, it would also be useful if the program allowed you to click&drag to select say a square of numbers and the program would report whether the selected square's determinant is 0 or not, this is just for starters

(11-08-2022, 03:34 PM)Pete Wrote: I sometimes wonder why they call them cans of worms... and not barrels. ???

Pete

I almost suggested to get a thread but what had me slightly put off is that these things are infinite in each direction like game of life, keeps expanding... like off topic walls of worms ;-))

LOL @ Wall of Worms. Exactly. Sam-Clip will turn out the same way. To be really useful, it just about needs to be equivalent to a WP like Notepad. Easy to get sucked into these endeavors though. I've been working on Sam-Clip and over about 9 straight days I've experienced the worst head and face pain I've ever had. On the mend as of today, just tired and worn out. I need to make a Ctrl+Alt+Del key for the brain. Oops, opening up another can again!

Pete
Reply
#20
Universal program for learning other languages
for example C# & Python
translating every line and paragraphs qb64 qbasic

output to screen
keyboard input array size
1-dimensional array
2-dimensional array
random
mathematics
for loop
condition
while loop
output to a file
read from file
and it can be useful to students and teachers

Script:

Start random
Set or enter size of array n from keyboard
Start arrays 1-dimensional and 2-dimensional given n
Start arrays of results 1-dimensional and 2-dimensional

Array 1 random from 0 to 9: filling and output

If element is even: calculate square
otherwise, leave value as it is
and put results in another array
and print both arrays in a column

Bubble sorting of final array
nested loops and exchanges

Output sorted final array via while

Fill 2-dimensional array with sums of column and row numbers
If value is odd: square
it, otherwise leave value and create another 2-dimensional array
and display original matrix and result

Create a file name as 2 random digits and ".txt"

Output result matrix to file in reverse order
where both rows and columns are inverted

Close file for writing and open file for reading

Read from file to variable w
and form a matrix on screen inverse of matrix 2

Everyone can + must = must
translate entire program or part of program independently
and I translated into Python & C# as brothers qb64 qbasic

Universal Yabasic: https://jdoodle.com/ia/CUo
Universal C#: https://rextester.com/RYGR5556
Universal C++: https://rextester.com/DHHKPJ12975
Universal Python https://rextester.com/YJZQQ73725

Code: (Select All)
Randomize Timer: t=timer: n = 3: ' Print "n= ": input n
Dim d(n), a(n, n), x(n), y(n, n) ' universe.bas

For i = 1 To n: d(i) = Int(Rnd * 9)
Print d(i);: Next: Print: Print

For i = 1 To n
If d(i) Mod 2 = 0 Then x(i)=d(i)^2 Else x(i)=d(i)
Print d(i), x(i): Next: Print

For i = 1 To n - 1: For j = i + 1 To n
    If x(i) > x(j) Then Swap x(i),x(j)
Next: Next

i = 1: While (i <= n)
    Print x(i);: i = i + 1
Wend: Print: Print

For i = 1 To n: For j = 1 To n
    a(i,j) = i + j
    If (a(i,j) Mod 2 <> 0) Then
        y(i,j) = a(i,j)^2
    Else
        y(i,j) = a(i,j)
        End If
Print a(i,j);: Next: Print: Next: Print

For i = 1 To n: For j = 1 To n
Print y(i,j);: Next: Print: Next: Print

a$ = Mid$(Str$(Int(Rnd * 88) + 10) + ".txt", 2, 6)

Open a$ For Output As #1
For i = n To 1 Step -1: For j = n To 1 Step -1
Print #1, y(i,j);: Next: Print #1,: Next: Print #1,

Close: Open a$ For Input As #2

For i = 1 To n: For j = 1 To n
Input #2, w: Print w;: Next: Print: Next: Print
Close

min = d(1): max = d(1):  nmin=1: nmax=1
for i=2 to n
if d(i)< min then min=d(i): nmin=i
if d(i)> max then max=d(i): nmax=i
next
for i=1 to n: Print d(i);: next: Print: Print 
Print min; nmin, max; nmax

s=0: for i=1 to n: s=s+d(i): next: ? s, s/n
_delay .25: Print Timer - t: End

Results for n=5 from Python

Code: (Select All)
Array d in a string
6 0 7 8 5

Array d even x=d^2
6 36
0 0
7 7
8 64
5 5

Array x sorting
and output x via while
0 5 7 36 64

Array y sum or odd y=d^2
0 1 2 9 4
1 2 9 4 25
2 9 4 25 6
9 4 25 6 49
4 25 6 49 8

Array d minimax from:
6 0 7 8 5

0 1 8 3

Sum d and average
26 5,20
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic

Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Reply




Users browsing this thread: 9 Guest(s)