Any Algorithm To Shorten Very Large Integer?
Dec 8, 2010
I have a function which generates a very large Integer (I do this by using Biginteger from vjslib.dll and I am able to operate all kind of arithmetic operators on such a biginteger.) But, My goal is to shorten this big integer into a small integer. Is there any algorithm? or a mathematical Formula which I can use to represent it in a small integer and use some reverse formula to get the original Big integer?
The big integer my function creates goes like this:
98761210112313489375987956157462364864823458794572 34573485683465868234568613123749081377932457923457 93475897836587236458678234568234658362458762347895 68932456892346578636123846715376123475745723645666 38247687346128346812364812364816341384612384678345 76341236412783461278346781236481263489126348971238 41134681273467812364789
I do not want to represent my bigInteger in a higher base as it will not be possible to do conversion into higher bases with such a large integer.
View 2 Replies
ADVERTISEMENT
Jun 10, 2012
How could i round an integer number based on the last digit of the number?
For example:
Dim x As Integer = 12
Dim y As Integer = 139
Dim z As Integer = 2322
[Code].......
View 3 Replies
Aug 17, 2009
I've written an algorithm that I believe to be correct for computing prime numbers up to n with the Sieve of Eratosthenes. Unfortunately, this program hangs on really large values of n (try 10 million). Here is what I've written...
Protected Function Eratosthenes(ByVal n As Integer) As String
Dim maxValue As Integer = Math.Sqrt(n)
Dim values As Generic.List(Of Integer) = New Generic.List(Of Integer)
[code]...
How might I speed this algorithm up? Where are my bottlenecks?
View 12 Replies
Jun 8, 2009
I am trying to implement an Algorithm called "Diamond-Square Algorithm" I am having trouble ending it so that it retiurns the required result. So far I have the folloiwng.
[Code]...
View 3 Replies
Dec 20, 2011
This is the code that i would like shortenning, it uses a progress bar and a label that counts down with it: I'm using the language of VB..[code]
View 1 Replies
Sep 29, 2011
I'm trying to make this cleaner... I know there's lots of shortcuts for If statements, but I don't know what's best.
If item.RecurrenceId > 0 Then
xmlTextWriter.WriteElementString("recordtype", "2")
ElseIf IsNothing(item.OngoingEndDate) = False Then
xmlTextWriter.WriteElementString("recordtype", "1")
Else
xmlTextWriter.WriteElementString("recordtype", "0")
End If
View 5 Replies
Mar 2, 2009
Is there a way to shorten the code below?
Like example:
from weeklbl1 to weeklbl4
location = new point ()
[code].....
View 2 Replies
Jun 9, 2011
I want to write a program to do Markov chain, but my states are quite large. First of all I calculate all the transition probabilities and revenues for all states(1381860 total states), and store in a multidimensional array. Public RevArr(0 To 9, 0 To 750, 0 To 282) As Long
After that the iteration of markov chain should use these as inputs to calculate the steady-state probabilities. But when I try to run the main code I got this error.Exception of type 'System.OutOfMemoryException' was thrown.
The following is the declaration of second array I add just another dimension for storing all the iterations, but I get this error. Dim stateprob(IT + 1, 0 To 9, 0 To 750, 0 To 282) As single
View 1 Replies
Sep 15, 2010
Question: How to shorten this array creation ? I need to create an array of type ReportingService2005_WebService.Property with one property.
Something like:
Dim PropertyArray() as new ReportingService2005_WebService.Property(1)
I have to do this:
Dim PropertyArray As ReportingService2005_WebService.Property() = New ReportingService2005_WebService.Property(0) {}
PropertyArray(0) = New ReportingService2005_WebService.Property
[Code].....
View 1 Replies
May 4, 2012
Dim num as integer = 1.60285253
Msgbox(shorted num??)
I want msgbox to show only shorted version of that number, so It should give 1.06
And is is possible to make it round third number to higer? If I want limit it to 2 numbers only, it should show 1.06 as 1.1, but if number was 1.04 it shows shortened number as 1.0.
View 3 Replies
Mar 8, 2010
I am making a project for school with visual basic and its a mcdonalds ordering system.There are 50+ buttons which you can press to remove an item and my code works fine. only problem is it is waaaaayyyy to long and can be shortened with a wildcard. Does anyone know what a good way to put a wildcard in the following code would be:
Private Sub btnsmallfries_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsmallfries.Click
If Label2.Text = "Buy Mode" Then
[code].....
View 5 Replies
Jan 1, 2011
Im working a lot with normal strings and during my development process strings with lengts of 10.000+ characters are being processes which makes it a my application run slower.Is it possible to shorten the length of any of string, in a way in which it also can be reversed?
View 16 Replies
Feb 6, 2011
I am trying to use this code to shorten words like Hello to Hi, and Whats up to sup in a rich text box.
If Value.Contains("Hello") Then
Value.Replace("Hello", "Hi")
End If
End Sub
View 4 Replies
Mar 31, 2010
If xtn <> ".bmp" And xtn <> ".jpg" And xtn <> ".jpeg" And xtn <> ".png" And xtn <> ".gif" Then
I am getting a feel that there should an better way to do this
View 4 Replies
Jul 13, 2011
I want a textbox to be checked for specific characters. I can use: with textbox1.text If .contains("a") or .contains("b") or .contains("c")...etc... then...
View 7 Replies
Apr 2, 2010
I am a C# programmer but dabbling in VB.Net because everybody else in my team uses it. In the interests of professional development I would like to shrink the following If... Else... statement.
If cmd.Parameters("@whenUpdated").Equals(DBNull.Value) Then
item.WhenUpdated = Nothing
Else
item.WhenUpdated = cmd.Parameters("@whenUpdated").Value
End If
View 5 Replies
Feb 21, 2010
I have a combo box that has a drop down list with long values in the drop down
Ex:
LB - Pounds
GR - Grams
When the user selects on of the values I want to just show the Abreviaqtions and not the descriptions. So when the drop down is shown it shows
LB - Pounds
GR - Grams
When the user selects "GR - Grams" from the drop down list "GR" is the only this shown in the combobox. I've tried TextChange,SelectedIndexChange and SelectedValueChange but I can't get them to work.
View 1 Replies
Feb 3, 2010
I have some code which addes values into the items and subitems, which works fine.
vb.net
Case "Aa en Hunze"
Dim Lvi00 As New ListViewItem(New String() {"naam", "blabla"})
Dim Lvi01 As New ListViewItem(New String() {"adres", "blabla"})
Dim Lvi02 As New ListViewItem(New String() {"postc/plaats", "blabla"})
[Code]...
View 4 Replies
May 26, 2011
<%
Dim i As Integer
Dim isNow = DatePart("yyyy", Now)
[code].....
View 1 Replies
Oct 20, 2009
I'm sort of repeating the same steps. There's got to be a way to shorten it.I was able to shorten it before by making a generic function to create the radio buttons.This is the before the rewrite
Public Sub LoadPanels(ByVal tblClient As DataTable)
Dim count As Integer = 20
Dim tooltip As New ToolTip
Dim countName As Integer = 0
[Code]...
View 4 Replies
Sep 25, 2010
ive got some simple problem i cant understand how to solve.
str(1) is an array and integer(or double, tried both)
a(1) is an array and integer (or double, tried both)
a(1) = a(1) + 1
Label1.Text = str(1) + a
the big part is where i get: operator '+' is not defined for types 'integer' and '1-dimensional array of integer'.why do i get that message and what does it mean? how do i make the code do what i want?
View 1 Replies
Aug 11, 2011
I faced an error when upgrading VB6 code to VB.NET. The error occurs at AddressOf WindowProc
AddressOf expression cannot be converted to 'Integer' because 'Integer' is not a delegate type
My declaration for SetWindowLong is:
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA"(
ByVal hWnd As Integer,
ByVal nIndex As Integer,[code]....
What is the reason for the error I get?
View 1 Replies
Apr 25, 2011
I'm trying to create a linked list of an array of integers. Why is the following implicit conversion required?
When I run the code that contains that conversion, I get the following error.
As a real-time data acquisition user control data (a packet of an array of bytes) arrives every second, is converted into an integer array and inserted into a linked list.
The most recently arrived data is painted as coordinates on a grid at the right of a PictureBox using Graphics.DrawLine (pen,X1,Y1,X2,Y2).
The oldest data (arriving 120 seconds ago) will be drawn at the leftmost portion of the Picturebox.
Why a linked list rather than a list? To display 120 views of time sequence data, the draw routine the most recently inserted node to a node that points to Nothing. How do I limit the length of the linked list to 120 nodes and always ensure that the last node points to Nothing?
Do While Not item Is Nothing
item = item.NextItem
Loop
View 4 Replies
Aug 3, 2009
I am a newbie in VB and I got a piece of code which can display the current running program. I need to use that in VB2005 and I got the below error message. Can anyone help how to fix it?[code]
View 18 Replies
May 13, 2009
I'm trying to convert a VB6 project to .NET, but I get problems with some callback functions, and the following message comes up: "AddressOf' expression cannot be converted to 'integer' because integer is not a delegate type" I've seen several solutions to similar problems like this, but I am not able to understand this issue with delegates.
After the conversion, the code look like this:
Declare Function vsmsgwSetDataPackageCB Lib "vsmsgwW.dll" (ByVal PACKAGE As Integer, ByRef arg As Integer) As Integer
Dim arginitP As Integer
[Code]...
Which gives the error: Method 'Public Function PackageCB(HisNodeID As Integer, ByRef data() As Byte, ByVal length As Integer, ByRef arg As Integer) As Integer' does not have the same signature as delegate 'Delegate Function DelegatePackageCallback(hwnd As Integer, lparam As Integer) As Integer
View 1 Replies
Sep 19, 2011
I have a LINQ2Entity problem, I want to get the value, string, from a database, so I select FProducts.Serial_number, and to end the query, I do .ToDictionary. The problem is, it tells me that it doesn't have sufficient parameters, to convert ToDictionary. So I need something like select FProducts.Serial_number, Nothing). ToDictionary. Also FProducts.Serial_number, 0).ToDictionary doesn't work.
Sub GetStatistics(ByVal ProductNumbers As List(Of String), ByRef Passed As Integer, ByRef FailedProducts As List(Of String))
Passed = 0
FailedProducts = Nothing
[Code]...
View 2 Replies
May 9, 2012
this is for a BINGO game final project that I already turned in but this just bugged me that I could not get the sorting figured out. I am trying to get this to sort the random numbers in to columns under the correct letters but I keep getting the error Operator '>=' is not defined for types '1-dimensional array of Integer' and 'Integer' under the line:
[Code]...
View 5 Replies
Aug 11, 2011
I am new to EF Linq and I have been struggling with this query for a few days. From reading this forum, I have managed to get this far:
Dim noPic = (From f In myEntities.FriendLists
Where (f.UserID = Profile.ID)
Select f.FriendID).Except(From g In myEntities.GuestLists
Where g.EventID = _id
Select g.FriendID)
[Code]...
I am trying to get everybody from the FriendList who is not already on the GuestList to display in a Repeater control. After reading the forum I was able to append .First() to noPic at the myNoPic declaration and finally get a result but that only gave me the first element. Does anybody have any advice on how to accomplish this?
View 2 Replies
Mar 14, 2012
Why doesn't CDate(integer) work where integer has format of YYYYMMDD ?and why won't this stupid site let me submit such a short question when I have nothing else to add except some waffle at the end
View 2 Replies
Aug 3, 2010
This is giving me a headache. I have this link query here that grabs an ID
Dim mclassID = From x In db.SchoolClasses Where x.VisitDateID = _visitdateID Select x.ClassID And then later on I have this linq query
ViewData("Staff") = From t In db.Staffs Where t.ClassID = mclassID Select t
I've tried quite a few things but to no avail. I've attempted casting, converting, Is operand, etc.
View 5 Replies