Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
For challenges involving the manipulation of integers.
2
votes
Is this number an integer power of -2?
Fourier, 53 bytes
I~X1~N~G0(0-2*G~GX*X~PG*G>P{1}{0~O~N}G{X}{1~O0~N}N)Oo
I'll work on golfing this later, but the outline of this is:
X = User input
G = N = 1
Loop until N = 0
G = -2 * G
P …
0
votes
How long is my number?
Fourier, 30 bytes
I~S<0{1}{-2*S~S}S{0}{S^~S}SL^o
Try it on FourIDE!
Fourier doesn't have strings, so it uses logs instead. Bytes are wasted on supporting zero and negative numbers.
3
votes
Is this number an integer power of -2?
Casio BASIC, 76 bytes
Note that 76 bytes is what it says on my calculator.
?→X
0→O
While Abs(X)≥1
X÷-2→X
If X=1
Then 1→O
IfEnd
WhileEnd
O
This is my first venture into Casio BASIC... I never reali …
16
votes
53
answers
2k
views
How long is my number: Restricted Version
Find the original challenge here
Challenge
Given an integer, Z in the range -2^31 < Z < 2^31, output the number of digits in that number (in base 10). … Rules
You must not use any string functions (in the case of overloading, you must not pass a string into functions which act as both string and integer functions). …
33
votes
81
answers
6k
views
How long is my number?
Challenge
Given an integer \$Q\$ in the range \$-2^{100} ≤ Q ≤ 2^{100}\$, output the number of digits in that number (in base 10).
Rules
Yes, you may take the number as a string and find its length. … Assume the input will always be a valid integer.
Examples
Input > Output
-45 > 2
12548026 > 8
33107638153846291829 > 20
-20000 > 5
0 > 1 or 0
Winning
Shortest code in bytes wins. …
0
votes
Output the sign
Fourier, 18 17 bytes
I~A<0{1}{`-`}A/Ao
Try it on FourIDE!
Explanation pseudocode:
A = Input
If A<0 Then
Print "-"
End If
Print A/A
3
votes
Calculate power series result
Noether, 17 bytes
I~xI(ax!i^+~ai)aP
Try it online!
Explanation
I~x - Store the input in the variable x
I( ) - Loop until the top of the stack equals the input n
a …