  C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD # Find last digits with IF  » excel » Find last digits with IF

By : user2953725
Date : November 21 2020, 01:01 AM
Any of those help For a slightly different approach, assuming you want to return the A2 value only if it represents a date in the last 5 or first 5 days of any month you can use this formula in B2
=IF(DAY(TEXT(A2,"0000-00-00")+5)<11,A2,"") code : ## Prolog: find all numbers of unique digits that can be formed from a list of digits

By : user2020176
Date : March 29 2020, 07:55 AM
Any of those help The best thing I could come up with so far is this function: , You are missing case when you skip digit from list.
code :
`````` numberFromList([X], X) :-
digit(X), !.
numberFromList(List, N) :-
member(X, List),
delete(List, X, LX),
numberFromList(LX, NX),
( % use X
N is NX * 10 + X
; % skip X
N = NX
).
`````` ## String with 1000 digits, find the biggest 5 digits without an array

By : Dinah Kamunde
Date : March 29 2020, 07:55 AM
Hope this helps Although @ElliottFrisch and @dave provides more elegant answer, I tried to modify from your original version and here is my code (I have tested it):
code :
``````public class ThousandDigits {
public static void main(String[] args) {
int greatest = 0;
String num = ("73167176531330624919225119674426574742355349194934"
+ "96983520312774506326239578318016984801869478851843"
+ "85861560789112949495459501737958331952853208805511"
+ "12540698747158523863050715693290963295227443043557"
+ "66896648950445244523161731856403098711121722383113"
+ "62229893423380308135336276614282806444486645238749"
+ "30358907296290491560440772390713810515859307960866"
+ "70172427121883998797908792274921901699720888093776"
+ "65727333001053367881220235421809751254540594752243"
+ "52584907711670556013604839586446706324415722155397"
+ "53697817977846174064955149290862569321978468622482"
+ "83972241375657056057490261407972968652414535100474"
+ "82166370484403199890008895243450658541227588666881"
+ "16427171479924442928230863465674813919123162824586"
+ "17866458359124566529476545682848912883142607690042"
+ "24219022671055626321111109370544217506941658960408"
+ "07198403850962455444362981230987879927244284909188"
+ "84580156166097919133875499200524063689912560717606"
+ "05886116467109405077541002256983155200055935729725"
+ "71636269561882670428252483600823257530420752963450");

int max = -1;
for (int n = 0; n < num.length() - 4; n++) {
greatest = ((num.charAt(n) - '0') * 10000 + (num.charAt(n + 1) - '0') * 1000
+ (num.charAt(n + 2) - '0') * 100 + (num.charAt(n + 3) - '0') * 10 + (num.charAt(n + 4) - '0'));
if (max < greatest) {
max = greatest;
}
}
System.out.print(max);
}
}
`````` ## String with 1000 digits, find the biggest 5 digits without an array using the substring method

By : Atul Rawat
Date : October 28 2020, 10:01 AM
may help you . That's because you do not update the numChar inside the loop. You only do it once at the beginning. Also, the calculated substring needs to go from i to i+5 in the loop.
code :
``````int greatest = 0;
int max = -1;
//int numChar = Integer.parseInt(num.substring(0, 5)); <-- Not Here

for (int i = 0; i < num.length() - 5; i++) {
int numChar = Integer.parseInt(num.substring(i, i + 5)); //  <-- but here
greatest = numChar;

if (max < greatest) {
max = greatest;
}
}
`````` ## POSTGRES SQL query to find all the rows which have one column contains number with format like 11 digits - 4 digits

By : Shravanthi S
Date : March 29 2020, 07:55 AM
wish of those help SELECT * FROM your_table WHERE your_column ~ '^[A-Z]{3}:\d{11}-\d{4}\$';
~ tilde is used for regex evaluation and you can evaluate that the expression matches your needs here ## how to find the sum of digits of sum of digits of each of T numbers repeatedly in python till it gets to being a single

By : user1686340
Date : March 29 2020, 07:55 AM
To fix the issue you can do You are using recursion to solve this. It is more efficient to simply use a loop:
code :
``````def gimmeNumber(text):
""""Helper: Asks for input until valid integer number is inputted. Retuns the number"""
while True:
T = input(text).strip()
if T and T.isdigit():
T = int(T)
break
print("Thats not a number ...")
return T

def sumDigits(number):
return sum(int(x) for x in str(number))

T = gimmeNumber("How many numbers? ")
for _ in range(T):
s = 0
N = gimmeNumber("Give me a number: ")
# calculate the cross-sum
s = sumDigits(N)
while s > 9: # repeat while greater then 9
s = sumDigits(s)

print(s)
``````
``````9
6
9
3
``````
``````def gimmeNumber(text):
""""Helper: Asks for input until valid integer number is inputted. Retuns the number"""
while True:
try:
T = int(input(text).strip())
break
except ValueError as e:
print("Thats not a number ...")
return T
`````` 