Fibonacci Numbers
Fibonacci Numbers start with f(1)=1 and f(2)=1 (some includes f(0)=0 but this is irrelevant to this challenge. Then, for n>2, f(n) = f(n-1) + f(n-2).
The challenge
Your task is to find the n-th positive number that can be expressed as products of Fibonacci numbers. You can ch...
The Pointer, often called the English Pointer, is a medium to large-sized breed of dog developed in England as a gun dog. It is one of several pointing breeds.
== Appearance ==
=== Coat and color ===
The coat of a Pointer is short, dense, smooth with a sheen. They are generally white with either liver, lemon, orange or black markings. Although pointers may have solid coloring in any of these hues, most pointers are primarily white with some body markings.
Lemon and white dogs have flesh-colored noses, while Pointers with orange, liver or black markings have dark (black or very dark bro...
The existence of The brand new drugs is especially regarding for the reason that There's no information to assistance their basic basic safety, noticeably a lot less their efficacy
rectangular -> polar
code-golfmathgeometrytrigonometry
Meta:
I'm not yet sure, whether I only should ask for atan2 or for the complete rectangular->polar conversation including the radius.
Should the output be in the range [0°, 360°) or [-180°,180°) or [-360°, 360°] or another range, or any a...
Staying Power Rx Extreme Countless numerous dietary supplements are now being created each and every month which can be spiked Using these prescription prescription medications — and even worse, fully novel medicine.” The existence of The brand new drugs is especially regarding for the reason that There's no information to assistance their basic basic safety, noticeab…
Your goal is to make a program that converts a (Black and white) .png image to a .txt file in ASCII, and then save it somewhere.
This is a code golf, so the smallest program wins!
Vedic method (base 4):
The square root of 25 is 5.
Time elapsed: 2.2E-4 ms.
The square root of 100 is 10.
Time elapsed: 2.1E-4 ms.
The square root of 10 is 3.
Time elapsed: 2.1E-4 ms.
The square root of 10000000000000000 is 100000000.
Time elapsed: 2.4E-4 ms.
The square root of 12345678987654321 is 111111111.
Time elapsed: 2.6E-4 ms.
The square root of 18446744073709551615 is 4294967295.
Time elapsed: 2.9E-4 ms.
The square root of 18446744065119617025 is 4294967295.
Time elapsed: 2.9E-4 ms.
The square root of 18446744065119617024 is 4294967294.
public class Integer_sqrt_compare {
public static String unsigned_long_to_string(long l){
//calculate remainder modulus 10
long remainder = 0, quotient = 0;
while(l < 0){
l -= 0x5000_0000_0000_0000L;
quotient += 0x0800_0000_0000_0000L;
}
remainder = l%10;
quotient += l/10;
if(quotient > 0){
return Long.toString(quotient)+Long.toString(remainder);
}else{
return Long.toString(remainder);
}
}
public static String unsigned_int_to_string(int i){
//calculate remainder modulus 10
But, I made a slight optimization for the binary search for small numbers
Doing some reading and it seems like if your computer has a number-of-leading-zeroes instruction, you can use that to get a pretty good initial guess to kick off the algorithms
public static int highestOneBit(int i) {
// HD, Figure 3-1
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
return i - (i >>> 1);
}
public static int lowestOneBit(int i) {
return i & -i;
}
@trichoplax It's perfectly appropriate. The problem is that the way they are defined means that the first number with more than 1 divisor is included...which means the first prime number in this case.
@zʏᴀʙiɴ101: First, find out who is interested in playing your game. I for one am not.
@flawr Well, true. Perfect numbers for when the sum of divisors is the number itself. Amicable numbers are for pairs where the sum of divisors of one number is the other number.
Hello, are HDLs such as Verilog appropriate as solutions for this site's questions? I can't seem to find anything on meta suggesting yes or no, or any I/O restrictions.
Byte-counting is the lest of my worries; more so the fact that input/output is really weird. I don't believe any other languages out there use a clock signal alongside I/O.
Sometimes it really is a struggle to convert cartesian coordinates (x,y) to polar coordinates (r,phi). While you can calculate r = sqrt(x^2+y^2) quite easily, you often need some distinction of cases when calculating the angle phi because arcsin,arccos and arctan and all other trigonometric funct...
@zʏᴀʙiɴ101 I'm cancelling the automatic suspension that happens when several people flag a post at once. A lot of the time you are an interesting part of the conversation, but please hold back on pushing the topic you want. If we all flow with the topics the room is interested in the conversation will go much more smoothly :)
@DrGreenEggsandIronMan For a vector (row or column) use P, yes. In general, for 2D arrays (such as matrices) or multidimensional arrays , P reverses along the first dimension which is not singleton. XP always reverses along the first dimension