Questions tagged [digit]

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

Anything related to numerical digits, i.e. the symbols used to write the representation of a number in a number system, such as decimal, hexadecimal, octal or binary systems.

See Wikipedia page on numerical digits.

375 questions
1
vote
1 answer

Factorial nonzero digits don't match

Here is a simple program to find the last several non-zero digits of the product of the numbers 1 through 105, removing trailing zeros along the way: def f(a, b): s = 1 for i in range(a, b+1): s *= i while not s % 10: …
qwr
  • 9,525
  • 5
  • 58
  • 102
1
vote
1 answer

How can i disect an integer into individual digits?

I want to know how I would be able to get each individual digit from an integer. See I have this program that adds each individual digit from the integer that was input into the program. However I think that there is a simpler way to do this. import…
Yogi_CS
  • 29
  • 1
  • 6
1
vote
1 answer

Save images from url with variable

After your help, many stackoverflow posts, the solution is at the bottom of this post as an UPDATE. I am trying to save some images automatically using this code in a php file : for ($num1=100;$num1<999;$num1++) { for…
Datacrawler
  • 2,780
  • 8
  • 46
  • 100
1
vote
2 answers

How to limt the digit size into single in python regex

I have a text file like below: INPUT.txt 155 Phe 12xD,7xQ,5xE,5xG,4xA,4xS,2xF,2xH,2xI,2xK,1xM,1xN 151 Glu 11xD,6xA,5xE,3xF,3xG,3xM,2xI,2xS,1xH,1xK,1xL,1xP 159 Thr 15xF,6xL,6xM,5xG,5xI,5xT,4xA,4xV,3xR,1xD,1xN,1xP Here, My aim is: To…
user3805057
  • 195
  • 1
  • 13
1
vote
2 answers

Undefined symbols for architecture x86_64 - ld: symbol(s) not found for architecture x86_64

I am not able to solve the below error. I have used cocoapods for external libs/frameworks. Ld /Users/MyAppapp/Library/Developer/Xcode/DerivedData/MyApp-ceyvfirzookxqtdglefjjtyixokw/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal…
JiteshW
  • 2,195
  • 4
  • 32
  • 61
1
vote
3 answers

Write a program that outputs the total of 5-digit numbers with a five in them, but not with an 8

My challenge is to output the total number of five-digit numbers that have a digit 5, but no digits 8. My only two answers so far have been 0, or 90000. Can anyone help me? #include using namespace std; int main() { int number; …
Owen Pauli
  • 27
  • 3
1
vote
3 answers

Which data structure(or type) would be useful for defining the digit amount of a number?

Hi there fellow programmers, I know that should be easy but I need to define the digit amount of a number for trying all the combinations in a project. The digit number shouldn't be affected by users actions because the change of the digit amount…
1
vote
1 answer

Obtaining the Individual Digits from and Integer - C programming

I am trying to break down a number and obtain each individual digit. I am trying to do that by dividing by powers of ten until reaching 0. Every time I divide by ten it adds to the total of digits in the integer. Once I have the total number of…
Jack Swanson
  • 399
  • 1
  • 4
  • 9
1
vote
3 answers

sum of Digits through Recursion

I am trying to make a recursive function which should return the sum of digits. The function should have only one argument. So far I have this; public int sumDigits(int n) { if(n%10 == n) // last digit remains return n; else{ …
Haris Ghauri
  • 547
  • 2
  • 7
  • 27
1
vote
1 answer

Calculate Nth Pi Digit

I am trying to calculate the nth digit of Pi without using Math.Pi which can be specified as a parameter. I modified an existing algorithm, since I like to find the Nth digit without using string conversions or default classes. This is how my…
Dark Side
  • 695
  • 2
  • 8
  • 18
1
vote
1 answer

How to write procedure that recursively outputs the number of odd digits in a natural number? (racket)

If the input is a number, how can I write a procedure that checks every digit and produces an output equal to the number of odd digits in this number? I'm thinking about turning the number into a list first, but I'm trying to think of an easier…
gurdingering
  • 207
  • 5
  • 12
1
vote
2 answers

R digit-expression and unlist doesn't work

So I've bought a book on R and automated data collection, and one of the first examples are leaving me baffled. I have a table with a date-column consisting of numbers looking like this "2001-". According to the tutorial, the line below will remove…
TheRecruit
  • 184
  • 9
1
vote
3 answers

Digits of a number in Racket are in random order

I decided to write a function that given a number will return a list containing the digits in that number, my attempt is: (define (rev-digits n) (if (= n 0) '() (cons (modulo n 10) (digits (quotient n 10))))) (define (digits n) (reverse…
Caridorc
  • 6,222
  • 2
  • 31
  • 46
1
vote
2 answers

How can I have an int variable with 0 as the first number in Python?

So, I'm doing some practice before my school assessment, was wondering how I'd make it so that when I enter an integer with a 0 as the first value, it wouldn't convert it into an integer with no zero at the start. Here's a little extract of my…
HazzaMcJazza
  • 53
  • 1
  • 8
1
vote
4 answers

Shouldn't isdigit() be faster in c++?

I am using isdigit() function in c++, but i found it's slow, so i implemented my own is_digit(), see my code below: #include #include #include using namespace std; static inline bool is_digit(char c) { return…
user1024
  • 982
  • 4
  • 13
  • 26