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.

A295793 a(n) is the least k such that A295520(k) = n.

This page as a plain text file.
%I A295793 #15 Aug 24 2023 02:42:36
%S A295793 2,4,0,8,25,24,35,34,201,200,203,202,297,296,299,298,1335,1334,1333,
%T A295793 1332,1331,1330,1329,1328,3295,3294,3293,3292,3291,3290,3289,3288,
%U A295793 11749,11748,11761,11760,11745,11744,11765,11764,11757,11756,19623,19622,11753,11752,19619,19618,25475,25474,25473,25472
%N A295793 a(n) is the least k such that A295520(k) = n.
%H A295793 Robert Israel, <a href="/A295793/b295793.txt">Table of n, a(n) for n = 0..175</a>
%e A295793 a(3)=8 because A295520(8)=3 and this is the first appearance of 3 in A295520.
%p A295793 N:= 100: # to get a(0)..a(N)
%p A295793 A295520:= proc(n) local k;
%p A295793   for k from 0 do if isprime(Bits:-Xor(k,n)) then return k fi od
%p A295793 end proc:
%p A295793 V:= Array(0..N,-1):
%p A295793 count:= 0:
%p A295793 for n from 0 while count < N+1 do
%p A295793 r:= A295520(n);
%p A295793 if r <= N and V[r]=-1 then
%p A295793    count:= count+1; V[r]:= n
%p A295793 fi
%p A295793 od:
%p A295793 convert(V,list); # _Robert Israel_, Nov 27 2017
%t A295793 With[{s = Array[Block[{k = 0}, While[! PrimeQ@ BitXor[k, #], k++]; k] &, 10^6]}, FirstPosition[s, #][[1]] /. 1 -> 0 & /@ Take[#, LengthWhile[Differences@ #, # == 1 &]] &@ Union@ s] (* _Michael De Vlieger_, Nov 27 2017 *)
%o A295793 (Python)
%o A295793 from itertools import count
%o A295793 from sympy import isprime
%o A295793 def A295793(n): return next(k for k in count(0) if next((m for m in range(n+1) if isprime(k^m)),None)==n) # _Chai Wah Wu_, Aug 23 2023
%Y A295793 Cf. A295520.
%K A295793 nonn,base,look
%O A295793 0,1
%A A295793 _Robert Israel_, Nov 27 2017