login
A262433
Quater-imaginary representation of the Gaussian primes with an even imaginary part.
0
3, 11, 13, 21, 31, 101, 111, 113, 123, 133, 201, 211, 213, 223, 233, 301, 321, 323, 331, 1003, 1011, 1021, 1031, 1033, 1101, 1113, 1123, 1131, 1133, 1201, 1203, 1213, 1223, 1231, 1233, 1311, 1321, 1323, 2001, 2011, 2031, 2033, 2103, 2113, 2131, 2133, 2203
OFFSET
1,1
COMMENTS
Not all Gaussian primes will be in this list as complex numbers with an odd imaginary part require a value after the radix point (".") in the quater-imaginary number system.
LINKS
Donald Knuth, An imaginary number system, Communications of the ACM 3 (4), April 1960, pp. 245-247.
OEIS Wiki, Gaussian primes
EXAMPLE
1231_(2i) = 1(2i)^3 + 2(2i)^2 + 3(2i)^1 + 1(2i)^0 = -7-2i which is a Gaussian prime.
PROG
(C++)
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <fstream>
using namespace std;
bool isPrime(int n)
{
if (n <= 1)
return false;
if (n == 2)
return true;
if (n % 2 == 0)
return false;
int rootNCeil = (int)sqrt(n) + 1;
for (int div = 3; div <= rootNCeil; div+=2)
{
if (n % div == 0)
return false;
}
return true;
}
int main()
{
const int maxDigits = 8;
unsigned int maxVal = 2 << ((maxDigits * 2) - 1);
for (unsigned int n = 0; n < maxVal; n++)
{
// Split binary representation of n into real part and imaginary part
int rp = (n & 0x00000003) - ((n & 0x00000030) >> 2) +
((n & 0x00000300) >> 4) - ((n & 0x00003000) >> 6) +
((n & 0x00030000) >> 8) - ((n & 0x00300000) >> 10) +
((n & 0x03000000) >> 12) - ((n & 0x30000000) >> 14);
int ip = ((n & 0x0000000c) >> 1) - ((n & 0x000000c0) >> 3) +
((n & 0x00000c00) >> 5) - ((n & 0x0000c000) >> 7) +
((n & 0x000c0000) >> 9) - ((n & 0x00c00000) >> 11) +
((n & 0x0c000000) >> 13) - ((n & 0xc0000000) >> 15);
if ((ip == 0 && (abs(rp) % 4 == 3) && isPrime(abs(rp))) ||
(rp == 0 && (abs(ip) % 4 == 3) && isPrime(abs(ip))) ||
(rp != 0 && ip != 0 && isPrime(rp*rp + ip*ip)) )
{
char digits[maxDigits + 1];
_itoa(n, digits, 4);
cout<<digits << ", " << rp << (ip >= 0 ? "+" : "") << ip << "i\n";
}
}
}
CROSSREFS
A002145 when translated using A212494 is a subsequence.
Real and imaginary parts of the Gaussian primes A103431, A103432.
Sequence in context: A329761 A167612 A299974 * A116438 A191078 A281816
KEYWORD
nonn,base
AUTHOR
Adam J.T. Partridge, Sep 22 2015
STATUS
approved