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
2
votes
2 answers

Digit recognizion of non light/color digits using Python/OpenCV

I am using OpenCV 4 and latest Python version. Got all the packages aswell. I know how to resize, grayscale, blur, edge etc, but I get so many errors, seems like I cant get any detection. Here is the Multimeter display image which is cropped which…
Edde87
  • 59
  • 1
  • 3
2
votes
1 answer

Is there an MNIST dataset where the digits are in colour?

I would like to use the MNIST dataset, where each digit is assigned a specific colour. Not the background, the digit itself. The following dataset colours the background of the image:…
leenremm
  • 1,083
  • 13
  • 19
2
votes
2 answers

Generate sequence of numbers whose k-th digit from the left and from the right sums to 10 for all k

A Python coding exercise asks to make a function f such that f(k) is the k-th number such that its k-th digit from the left and from the right sums to 10 for all k. For example 5, 19, 28, 37 are the first few numbers in the sequence. I use this…
Mike
  • 444
  • 1
  • 8
  • 19
2
votes
1 answer

Sorting an integer's digits in descending order

So say we have a number -- 123456 for simplicity sake. I needed a function that would take that as input and return 654321, or say 53283940, same would return 98543320. I have something seems to work I'm just not sure if it's done with best…
exception-io
  • 115
  • 6
2
votes
2 answers

How to check whether a char is from a particular set of characters or not

I am was making an if statement when I needed to check whether an unknown char is of any character set. Predefined or Custom. I could just make many or statements but it would get messy. So is there any regex present to do this. I used a charAt();…
2
votes
0 answers

How to filter data with count digit with regex in node.js and mongodb?

I want to filter the data from db with the help of regex that count the digits.i have a regex that count digits but its not working in mongodb query getting some error or empty result.regex is below "^(\d {1})$" . Don't know how to how to use this…
Hammad ul Hasan
  • 306
  • 3
  • 15
2
votes
3 answers

Get a number from an array of digits

To split a number into digits in a given base, Julia has the digits() function: julia> digits(36, base = 4) 3-element Array{Int64,1}: 0 1 2 What's the reverse operation? If you have an array of digits and the base, is there a built-in way to…
Sphinxxx
  • 12,484
  • 4
  • 54
  • 84
2
votes
0 answers

How to preserve the inputted value in data frame in R

I am creating a simple data frame of inputted values and I want the values to maintain the digits and decimal places I inputted. Instead, R is increasing decimal places for some of the inputted values. Inputting values: k = 100 lambda =…
2
votes
3 answers

method that return digit by index

I want to write a method that returns digit of a number (num) by index (place) while not using array only loops and conditions. For example: For the input num = 17489, place = 1 the method returns 9 But if the index does not exist in the like num =…
MarcoPolo
  • 21
  • 3
2
votes
3 answers

Turkish Identity Number Verification in Swift

How can I make sure that the given text is Turkish Identity Number? I have seen js version here and phthon version here Turkish Identity Verification is not checks only if its numeric, it has some other functions too. Let me be more clear, It is…
rozeri dilar
  • 301
  • 1
  • 16
2
votes
8 answers

Efficient algorithm to calculate the sum of number of base2 digits (number of bits) over an interval of positive integers

Let's say I've been given two integers a, b where a is a positive integer and is smaller than b. I have to find an efficient algorithm that's going to give me the sum of number of base2 digits (number of bits) over the interval [a, b]. For example,…
user7048295
2
votes
4 answers

Circularly shifting (or rotating) the digits the digits of a number in Python

Suppose I have the following input: 1234 How can I get the following output? 3412 This is obtained by circularly shifting (or rotating) the digits of the input twice. I have tried the following code: number = 1234 bin(number >> 1) but it is not…
Tanya Chaudhary
  • 95
  • 1
  • 4
  • 13
2
votes
1 answer

How to validate numeric strings in inputText with validateRegex in a JSF-Page

I have a managed bean with this string property private String itemNumber; In the JSF I want to validate the input for length of 10 characters and allow only digits. The input will have preceding zeros. For example "0000123456"
PosNerd
  • 33
  • 4
2
votes
0 answers

MYSQL - How to convert a string resulting from GROUP_CONCAT function into a digit

I have been stuck for a while with this query and was wondering if anyone here knows what I may be doing wrong. The problem I'm facing is that the following query sends me a 0 instead of a -5 and if I remove the "CAST" function, I get -05, so it…
2
votes
2 answers

Is subtracting a char by '0' to convert to int bad practice?

I'm expecting a single digit integer input, and have error handling in place already if this is not the case. Are the any potential unforeseen consequences by simply subtracting the input character by '0' to "convert" it into an integer? I'm not…
Sellyme
  • 179
  • 1
  • 14