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.

A298817 a(n) is the binary XOR of all n-bit prime numbers.

This page as a plain text file.
%I A298817 #19 May 09 2021 07:56:20
%S A298817 0,1,2,6,23,59,99,203,469,807,1615,3349,2266,4576,14042,25002,89193,
%T A298817 131215,135904,814531,885682,60842,3969154,3370892,6742296,14350136,
%U A298817 42766902,97565102,444197631,515121776,2085329975,2091732354,7999937231,14794305847
%N A298817 a(n) is the binary XOR of all n-bit prime numbers.
%C A298817 XOR is the binary exclusive-or operator.
%C A298817 a(1)=0 for compatibility with similar sequences, and because 0 and 1 are not primes.
%C A298817 Note the sequence s(n)-a(n), where s(n)=A298816(n) is the binary XOR of all n-bit squares, begins: 1, -1, 2, 3, -14, -38, -87, -175, -20, -230, -1258, -2352, 3819, 9957, -1525, -9925, 31932, 21654, 264124, 226521, 405022, 2495526, 944510, 8579700, 15679080, 49342536, -35092149, -19209773, -131473914. The distribution of negative and positive terms does not look random: runs of negative terms are followed by runs of positive terms.
%H A298817 Lars Blomberg, <a href="/A298817/b298817.txt">Table of n, a(n) for n = 1..41</a>
%e A298817 There are two 4-bit primes, namely 11 and 13.  a(4) = (11 XOR 13) = 6.
%o A298817 (Python)
%o A298817 from sympy import nextprime
%o A298817 n = x = L = 2
%o A298817 print('0', end=',')
%o A298817 while L < 27:
%o A298817     nextn = nextprime(n)
%o A298817     if (nextn ^ n) > n:  # if lengths of binary representations are different
%o A298817         print(str(x), end=',')
%o A298817         x = 0
%o A298817         prevL = L
%o A298817         L = len(bin(nextn))-2
%o A298817         for j in range(prevL, L-1):  print('0', end=',')
%o A298817     n = nextn
%o A298817     x ^= n
%o A298817 (PARI) a(n) = {my(x = 0); for (k=2^(n-1), 2^n-1, if (isprime(k), x = bitxor(x, k));); x;} \\ _Michel Marcus_, Jan 27 2018
%Y A298817 Cf. A000040, A007088, A070939, A035100, A298816.
%Y A298817 Cf. also A014234, A104080.
%K A298817 nonn,base
%O A298817 1,3
%A A298817 _Alex Ratushnyak_, Jan 26 2018
%E A298817 a(30)-a(34) from _Lars Blomberg_, Nov 10 2018