Squares
Re: Squares
@Richard
If k And 1 Then sum += non-binary( 0 )
could you make it a :
If k And "?" Then sum += non-binary( ? )
Shorten it to a single line???
If k And 1 Then sum += non-binary( 0 )
could you make it a :
If k And "?" Then sum += non-binary( ? )
Shorten it to a single line???
Re: Squares
Code: Select all
Screen 19
'====================================================
Const As Short max_bits = 4
' put your choice of numbers in this array, 0 for unused MSBs
Dim As Short non_binary( 0 To max_bits - 1 ) = { 1, 1, 4, 0 }
'====================================================
Dim As Short k, sum, n = 0, bits = 0
For k As Short = 0 To max_bits - 1
If non_binary( k ) Then
n += non_binary( k )' find the maximum possible represented number
bits += 1 ' find number of bits specified at LSB end
Else
Exit For ' the first zero found ends the game
End If
Next k
Dim As Short freq( 0 To n )
'====================================================
' evaluate binary pattern for all different possible codes
For k = 0 To ( 1 Shl bits ) - 1
sum = 0
For i As Short = 0 To bits - 1
If k And ( 1 Shl i ) Then sum += non_binary( i )
Next i
freq( sum ) += 1 ' accumulate frequency distribution
Next k
'====================================================
' report if missing or duplicate
For k = 0 To n
If freq( k ) = 0 Then Print k; " is missing."
If freq( k ) > 1 Then Print k; " is duplicated *"; freq( k )
Next k
Print " Maximum code is"; n
Print " Done. "
'====================================================
Sleep
'====================================================
Re: Squares
Thanks Richard!!
You Da God!!
You Da God!!
Re: Squares
I got 6 bits done!!!
Altered binary bits = { 10 , 14 , 16 , 18 , 23 , 36 , 0 , 0 } = 117
Now to fumble out the next 2 bits....
Altered binary bits = { 10 , 14 , 16 , 18 , 23 , 36 , 0 , 0 } = 117
Now to fumble out the next 2 bits....
Code: Select all
Screen 19
'====================================================
Const As Short max_bits = 8
' put your choice of numbers in this array, 0 for unused MSBs
Dim As Short non_binary( 0 To max_bits - 1 ) = { 10 , 14 , 16 , 18 , 23 , 36 , 0 , 0 }
'====================================================
Dim As Short k, sum, n = 0, bits = 0
For k As Short = 0 To max_bits - 1
If non_binary( k ) Then
n += non_binary( k )' find the maximum possible represented number
bits += 1 ' find number of bits specified at LSB end
Else
Exit For ' the first zero found ends the game
End If
Next k
Dim As Short freq( 0 To n )
'====================================================
' evaluate binary pattern for all different possible codes
For k = 0 To ( 1 Shl bits ) - 1
sum = 0
For i As Short = 0 To bits - 1
If k And ( 1 Shl i ) Then sum += non_binary( i )
Next i
freq( sum ) += 1 ' accumulate frequency distribution
Next k
'====================================================
' report if missing or duplicate
For k = 0 To n
'If freq( k ) = 0 Then Print k; " is missing."
If freq( k ) > 1 Then Print k; " is duplicated *"; freq( k )
Next k
Print " Maximum code is"; n
Print " Done. "
'====================================================
Sleep
'====================================================
Re: Squares
@Richard
I got an idea!!
How about modifying it so , it tells you what numbers you can add for the next bit..
It would scan all the values and then try others numbers and tell you if its safe to add that number to the next bit position..
So if you have a , 2 , 4 , 7 , it would tell you its safe to add a 10....
I got an idea!!
How about modifying it so , it tells you what numbers you can add for the next bit..
It would scan all the values and then try others numbers and tell you if its safe to add that number to the next bit position..
So if you have a , 2 , 4 , 7 , it would tell you its safe to add a 10....
Re: Squares
You commented out the line that reports these missing codes.
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 22, 25, 27, 29, 31,
35, 38, 43, 45, 56, 61, 72, 74, 79, 82, 86, 88, 90, 92, 95, 96, 97, 98, 100,
102, 104, 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116,
Maximum code is 117
They cannot be represented with bit values of only { 10 , 14 , 16 , 18 , 23 , 36 }
1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 17, 19, 20, 21, 22, 25, 27, 29, 31,
35, 38, 43, 45, 56, 61, 72, 74, 79, 82, 86, 88, 90, 92, 95, 96, 97, 98, 100,
102, 104, 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116,
Maximum code is 117
They cannot be represented with bit values of only { 10 , 14 , 16 , 18 , 23 , 36 }
Re: Squares
@Richard
With "Altered Binary" all the values can be represented...
{ 10 , 14 , 16 , 18 , 23 , 36 }
If you want to do a 1 then it turns it into a 10
If you want to do a 2 then it turns it into a 14
If you want to do a 3 then it turns it into a 24 ( 10 + 14 )
If you want to do a 8 then it turns it into a 18
If you want to do a 10 then it turns it into a 32 ( 18 +14 )
Thanks for writing the Non_Binary code for me.... I've been having fun playing with values...
But I've found ; that altering the binary bits , doesn't compress , unless there's duplicates..
If you take in a random string , and change all the values to all different individual values.. it won't compress...
It just shuffles the deck , all the original values are still there. their just in different orders...
The only way to compress:
Is to order the values so they make compressible patterns...
And that requires a map , which usually makes the idea expand...
There's another way , to cut off 0's or 1's , but again , the map makes it expand..
With "Altered Binary" all the values can be represented...
{ 10 , 14 , 16 , 18 , 23 , 36 }
If you want to do a 1 then it turns it into a 10
If you want to do a 2 then it turns it into a 14
If you want to do a 3 then it turns it into a 24 ( 10 + 14 )
If you want to do a 8 then it turns it into a 18
If you want to do a 10 then it turns it into a 32 ( 18 +14 )
Thanks for writing the Non_Binary code for me.... I've been having fun playing with values...
But I've found ; that altering the binary bits , doesn't compress , unless there's duplicates..
If you take in a random string , and change all the values to all different individual values.. it won't compress...
It just shuffles the deck , all the original values are still there. their just in different orders...
The only way to compress:
Is to order the values so they make compressible patterns...
And that requires a map , which usually makes the idea expand...
There's another way , to cut off 0's or 1's , but again , the map makes it expand..
Last edited by albert on Jul 24, 2020 1:53, edited 1 time in total.
Re: Squares
@Richard
I was wondering how you would undo it???
you can't do the normal :
if val > 128 then bit1+= 1 , val-= 128
if val > 064 then bit1+= 1 , val-= 064
etc...
I was wondering how you would undo it???
you can't do the normal :
if val > 128 then bit1+= 1 , val-= 128
if val > 064 then bit1+= 1 , val-= 064
etc...
Re: Squares
!!~~OFF TOPIC~~!!
I got my two songs demo'd , their done....
"I Got Music"
"Dinner Time"
https://soundcloud.com/user-704620747
The "I Got Music" , i didn't really care for the music they put it to... Bu the song sounds good lyric wise..
The "Dinner Time" song , they did it perfectly... Good music and singing..
I got my two songs demo'd , their done....
"I Got Music"
"Dinner Time"
https://soundcloud.com/user-704620747
The "I Got Music" , i didn't really care for the music they put it to... Bu the song sounds good lyric wise..
The "Dinner Time" song , they did it perfectly... Good music and singing..
Re: Squares
I came up with another multi-billion dollar idea...
"Vira-Vend" vending machines...
You insert your credit or debit card , and it charges you for the test..
It then spits out a straw , you insert the straw into a hole on the machine..
And blow into it...
It then uses liquid nitrogen , to condense the exhaled breath , into a liquid..
It then scans the liquid breath , under an electron microscope to look for viruses..
If it finds a virus , then it prints out a picture of the virus , so you can take it to the doctors office to get treated..
You would need some way to clean the condensing chamber between customers..
Every pharmacy on the planet would want a "Vira-Vend" machine...You could make trillions....
"Vira-Vend" vending machines...
You insert your credit or debit card , and it charges you for the test..
It then spits out a straw , you insert the straw into a hole on the machine..
And blow into it...
It then uses liquid nitrogen , to condense the exhaled breath , into a liquid..
It then scans the liquid breath , under an electron microscope to look for viruses..
If it finds a virus , then it prints out a picture of the virus , so you can take it to the doctors office to get treated..
You would need some way to clean the condensing chamber between customers..
Every pharmacy on the planet would want a "Vira-Vend" machine...You could make trillions....
Re: Squares
It would never work: viruses are not transmitted by exhaled air (not even airborne viruses), they are transmitted by the respiratory droplets (also called Flügge's droplets). They can be released by sneezing, by coughing, by talking, and sometimes by just breathing.
That is also the reason why masks work, even if they have pores that are larger than the virus: they could not stop the virus itself, but they can stop the droplets, and this is usually enough
So, a test made by blowing in a straw would be unreliable: exhaled air might not contain droplets, and without them the test would not detect any virus, even if there is actually a disease
That is also the reason why masks work, even if they have pores that are larger than the virus: they could not stop the virus itself, but they can stop the droplets, and this is usually enough
So, a test made by blowing in a straw would be unreliable: exhaled air might not contain droplets, and without them the test would not detect any virus, even if there is actually a disease
Re: Squares
@angros47
You wrote:
It would never work: viruses are not transmitted by exhaled air (not even airborne viruses), they are transmitted by the respiratory droplets (also called Flügge's
Breathing out , has the virus in it , that's why you wear masks.
To stop other peoples breath from getting into your mouth or nose..
Just plain exhaling ( breathing ) , spreads droplets out to 12 feet , with a mask it lowers it down to 6 feet...for a bandana mask..
Other types of real masks , lowers the 6 foot droplet spread to less than a foot..
For a double layer t-shirt type of mask the droplets of a normal exhale , only got out to 2 inches..
They showed a laser scanned exhale on TV the other day...
And the different types of masks , and how far the droplets go thru each type of mask.
A double layer cotton mask was the best only 2 inches... Not counting the N-95 masks.. That are preferred by healthcare workers..
I need another programming problem to solve...I'll play with numbers some more , and see if i can find some interesting number theory...
Back in "Circles" , I invented a way to divide by multiplying , you divide 1 by one number , and then multply the two numbers..
Richard used the concept in his Base1e9 code..
You wrote:
It would never work: viruses are not transmitted by exhaled air (not even airborne viruses), they are transmitted by the respiratory droplets (also called Flügge's
Breathing out , has the virus in it , that's why you wear masks.
To stop other peoples breath from getting into your mouth or nose..
Just plain exhaling ( breathing ) , spreads droplets out to 12 feet , with a mask it lowers it down to 6 feet...for a bandana mask..
Other types of real masks , lowers the 6 foot droplet spread to less than a foot..
For a double layer t-shirt type of mask the droplets of a normal exhale , only got out to 2 inches..
They showed a laser scanned exhale on TV the other day...
And the different types of masks , and how far the droplets go thru each type of mask.
A double layer cotton mask was the best only 2 inches... Not counting the N-95 masks.. That are preferred by healthcare workers..
I need another programming problem to solve...I'll play with numbers some more , and see if i can find some interesting number theory...
Back in "Circles" , I invented a way to divide by multiplying , you divide 1 by one number , and then multply the two numbers..
Richard used the concept in his Base1e9 code..
Last edited by albert on Jul 25, 2020 0:57, edited 1 time in total.
Re: Squares
Oh, so it was you who 'invented' the multiplicative reciprocal? Who would have thought...albert wrote:...
Back in "Circles" , I invented a way to divide by multiplying , you divide 1 by one number , and then multply the two numbers..
You need to go back to what you do best: writing songs. Seriously.
Re: Squares
@paul doe
You wrote:
Oh, so it was you who 'invented' the multiplicative reciprocal? Who would have thought...
When was "multiplicative reciprocal" invented???
When i came up with the idea , Richard didn't have any knowledge of it , And Richard is a professional mathematician..
And he used it in his code :
Modulo 10^9 floating point arithmetic. ( Search the "Tips&Tricks" section of the forum for it or Base1e9... ) either one will bring up the code.
You wrote:
Oh, so it was you who 'invented' the multiplicative reciprocal? Who would have thought...
When was "multiplicative reciprocal" invented???
When i came up with the idea , Richard didn't have any knowledge of it , And Richard is a professional mathematician..
And he used it in his code :
Modulo 10^9 floating point arithmetic. ( Search the "Tips&Tricks" section of the forum for it or Base1e9... ) either one will bring up the code.
Re: Squares
albert wrote:...
When was "multiplicative reciprocal" invented???
When i came up with the idea...
So, that must mean you are at least 223 years old... wow! Mind blowing!Wikipedia wrote: ...
The term reciprocal was in common use at least as far back as the third edition of Encyclopædia Britannica (1797)
...