Questions tagged [digits]

Questions dealing with getting, manipulating, or changing the digits of numbers

Use this tag for questions dealing with getting, manipulating, or changing the digits of numbers. More about digits on wikipedia

1098 questions
4
votes
6 answers

Finding number of digits of a number in C#

I'm trying to write a piece of code in C# to find the number digits of a integer number, the code works perfectly for all numbers (negative and positive) but I have problem with 10, 100,1000 and so on, it shows one less digits than the numbers'…
samix73
  • 2,802
  • 4
  • 17
  • 29
4
votes
2 answers

RegEx for fixed number of digits?

I'm finishing a form I have to do for my homework, and just when I thought I was finished, I found a mistake. I need a RegEx for input field that would return an alert if there's not exactly 13 digits. While I know the correct RegExp for this is:…
zduhac
  • 65
  • 1
  • 2
  • 6
4
votes
0 answers

Using django haystack autocomplete with elasticsearch to search for digits/numbers?

I'm using Django Haystack backed by Elasticsearch for autocomplete, and I'm having trouble searching for digits in a field. For example, I have a field called 'name' on an object type that has some values like this: ['NAME', 'NAME2', 'NAME7',…
Ethan
  • 255
  • 3
  • 9
4
votes
2 answers

Summing BigInteger Digits

I am trying to find the sum of the digits of the number 2^1000 and I am using Java BigInteger class for this. However, I could not make it real. Eventually, I get a 0 (zero) with the following code. What might be the problem? Thanks... After Kon's…
4
votes
3 answers

Java Regular Expression: match any number of digits in round brackets if the closing bracket is the last char in the String

I need some help to save my day (or my night). I would like to match: Any number of digits Enclosed by round brackets "()" [The brackets contain nothing else than digits] If the closing bracket ")" is the last character in the String. Here's the…
Kovács Imre
  • 715
  • 2
  • 7
  • 17
4
votes
1 answer

Interpreting double digit numbers

So, I'm having a bit of trouble with this piece of code. if s.get("home") < s.get("away"): scoringplays = scoringplays + s.get("away") + "-" + s.get("home") + " " + game.get("away_team_name") elif s.get("home") > s.get("away"): …
4
votes
14 answers

What programming language will enable me to enter a very long number without converting it to floating point?

What would be the best way to do the following. Enter a very long number, lets say 500,000 digits long without it going into scientific notation; and then am able to do math with it, like +2 etc.? Thank you in advance. EDIT: It is a 500,000 digit,…
ron8
  • 243
  • 2
  • 5
  • 13
4
votes
1 answer

how to find number of digits in assembly 8086?

I am a new assembly programer and I could not succeed in finding how many digits a number has.My purpose is to find factorials. I program in an emulator of assembly 8086.
TJR
  • 454
  • 8
  • 24
4
votes
3 answers

Ruby: counting digits in a float number

Is there any worthy Ruby method to count the number of digits in a float? Also, how do I specify the precise when to_s float numbers?
oldhomemovie
  • 14,621
  • 13
  • 64
  • 99
4
votes
3 answers

No of numbers less than a given number with no repeating digits

How can we find the number of numbers less than a given number with no repeating digits in it? For example the number of such numbers less than 100 is 90. (11, 22, 33,44, 55,66,77,88,99 have repeating digits so are excluded). Similarly for less than…
Ankur Ankan
  • 71
  • 1
  • 5
4
votes
4 answers

Find the sum of digits of n+1,n+2.... when sum of digits of n is given

We can easily compute the sum of digits of a given number but is there any mathematical formula or pattern we can use to determine the sum of next numbers without having to sum all the digits again and again? For example Sum of 1234 = 1+2+3+4 =…
Hrushikesh
  • 411
  • 5
  • 10
3
votes
7 answers

Identify the digits in a given number.

I'm new to programming, and I'm stuck at a problem. I want my program to identify the separate digits in a given number, like if I input 4692, it should identify the digits and print 4 6 9 2. And yeah, without using arrays.
Farhan
3
votes
1 answer

Scala BigDecimal how to display more decimals?

First of all, I am aware that there is a similar topic regarding the division of 1 by 3. However, my code is quite different and I don't know how to apply the information given there to my situation. I would appreciate any and all help. I made a Pi…
Alexandros
  • 533
  • 2
  • 7
  • 15
3
votes
1 answer

R: formatting the digits in xtable

I have the data: transaction <- c(1,2,3); date <- c("2010-01-31","2010-02-28","2010-03-31"); type <- c("debit", "debit", "credit"); amount <- c(-500, -1000.97, 12500.81); oldbalance <- c(5000, 4500, 17000.81) evolution <- data.frame(transaction,…
yCalleecharan
  • 4,656
  • 11
  • 56
  • 86
3
votes
1 answer

How to implement 128-bit linear feedback shift register with byte element array in C

I have an array as follows, unsigned char A[16] I am using this array to represent a 128-bit hardware register. Now I want to implement a linear feedback shift register (LFSR, Fibonacci implementation) using this long register. The polynomials (or…
drdot
  • 3,215
  • 9
  • 46
  • 81