OFFSET
1,1
COMMENTS
If this sequence is infinite, then the density of aperiodic necklaces (Lyndon words) in the reversed binary expansion of numbers and the density of prime numbers, may have some interesting connection. If there exists a deeper relation, an analogy of Goldbach's conjecture based on numbers in A328596 could be investigated, would that provide any new knowledge regarding prime numbers?
FORMULA
PROG
(MATLAB)
function a = A348352(max_range)
a = [];
bits = floor(log2(max_range))+2;
p = primes(max_range);
lw = lyndonwords(1);
lyndonw = lw{2};
for n = 2:bits
lyndonw =[lyndonw lyndonwords(n)];
end
for n = 1:length(p)
prime = p(n);
wraw = bitget(prime-1, 1:bits);
word = wraw(1:find(wraw == 1, 1, 'last' ));
if length(lyndonw{n}) == length(word)
if lyndonw{n} == word
a = [a prime];
end
end
end
end
function words = lyndonwords(maxlen)
words = cell(1);
wordindex = 1;
w = 0;
while ~isempty(w)
len = length(w);
if(len == maxlen)
s = [];
for j = 1:length(w)
s = [s w(j)];
end
words{wordindex} = s;
wordindex = wordindex + 1;
else
while length(w) < maxlen
w = [w w(1+length(w)-len)];
end
end
while ~isempty(w) && w(end) == 1
w = w(1:end-1);
end
if ~isempty(w)
w(end) = 1;
end
end
end
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Thomas Scheuerle, Oct 14 2021
STATUS
approved