cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A262433 Quater-imaginary representation of the Gaussian primes with an even imaginary part.

This page as a plain text file.
%I A262433 #21 Oct 23 2015 11:28:50
%S A262433 3,11,13,21,31,101,111,113,123,133,201,211,213,223,233,301,321,323,
%T A262433 331,1003,1011,1021,1031,1033,1101,1113,1123,1131,1133,1201,1203,1213,
%U A262433 1223,1231,1233,1311,1321,1323,2001,2011,2031,2033,2103,2113,2131,2133,2203
%N A262433 Quater-imaginary representation of the Gaussian primes with an even imaginary part.
%C A262433 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.
%H A262433 Donald Knuth, <a href="http://dl.acm.org/citation.cfm?id=367233">An imaginary number system</a>, Communications of the ACM 3 (4), April 1960, pp. 245-247.
%H A262433 OEIS Wiki, <a href="/wiki/Quater-imaginary_base">Quater-imaginary base</a>
%H A262433 OEIS Wiki, <a href="https://oeis.org/wiki/Gaussian_primes">Gaussian primes</a>
%H A262433 Wikipedia, <a href="http://en.wikipedia.org/wiki/Quater-imaginary_base">Quater-imaginary base</a>
%e A262433 1231_(2i) = 1(2i)^3 + 2(2i)^2 + 3(2i)^1 + 1(2i)^0 = -7-2i which is a Gaussian prime.
%o A262433 (C++)
%o A262433 #include <stdlib.h>
%o A262433 #include <math.h>
%o A262433 #include <iostream>
%o A262433 #include <fstream>
%o A262433 using namespace std;
%o A262433 bool isPrime(int n)
%o A262433 {
%o A262433   if (n <= 1)
%o A262433     return false;
%o A262433   if (n == 2)
%o A262433     return true;
%o A262433   if (n % 2 == 0)
%o A262433     return false;
%o A262433   int rootNCeil = (int)sqrt(n) + 1;
%o A262433   for (int div = 3; div <= rootNCeil;div+=2)
%o A262433   {
%o A262433     if (n % div == 0)
%o A262433       return false;
%o A262433   }
%o A262433   return true;
%o A262433 }
%o A262433 int main()
%o A262433 {
%o A262433   const int maxDigits = 8;
%o A262433   unsigned int maxVal = 2 << ((maxDigits * 2) - 1);
%o A262433   for (unsigned int n = 0; n < maxVal; n++)
%o A262433   {
%o A262433     // Split binary representation of n into real part and imaginary part
%o A262433     int rp = (n & 0x00000003) - ((n & 0x00000030) >> 2) +
%o A262433       ((n & 0x00000300) >> 4) - ((n & 0x00003000) >> 6) +
%o A262433       ((n & 0x00030000) >> 8) - ((n & 0x00300000) >> 10) +
%o A262433       ((n & 0x03000000) >> 12) - ((n & 0x30000000) >> 14);
%o A262433     int ip = ((n & 0x0000000c) >> 1) - ((n & 0x000000c0) >> 3) +
%o A262433       ((n & 0x00000c00) >> 5) - ((n & 0x0000c000) >> 7) +
%o A262433       ((n & 0x000c0000) >> 9) - ((n & 0x00c00000) >> 11) +
%o A262433       ((n & 0x0c000000) >> 13) - ((n & 0xc0000000) >> 15);
%o A262433     if ((ip == 0 && (abs(rp) % 4 == 3) && isPrime(abs(rp))) ||
%o A262433         (rp == 0 && (abs(ip) % 4 == 3) && isPrime(abs(ip))) ||
%o A262433         (rp != 0 && ip != 0 && isPrime(rp*rp + ip*ip)) )
%o A262433     {
%o A262433       char digits[maxDigits + 1];
%o A262433       _itoa(n, digits, 4);
%o A262433       cout<<digits << "," << rp << (ip >= 0 ? "+" : "") << ip << "i\n";
%o A262433     }
%o A262433   }
%o A262433 }
%Y A262433 A002145 when translated using A212494 is a subsequence.
%Y A262433 Real and imaginary parts of the Gaussian primes A103431, A103432.
%K A262433 nonn,base
%O A262433 1,1
%A A262433 _Adam J.T. Partridge_, Sep 22 2015