% Matlab % a(1) = 1, a(n)=a(n-1)-p(p(n))-p(n-1) if new and >0, else a(n)=a(n-1)+p(p(n))-p(n-1), where p(n) = n-th prime. % The highest prime to be found m=1366747; %1366747 for 10000 terms p = primes(m); n = length(p); a = zeros(1,n); a(1) = 1; for i = 2:n if p(i) > length(p) a = a(1:i-1); break end b = a(i-1) - p(p(i)) - p(i-1); if ismember(b, a(1:i-1)) || b<0 a(i) = a(i-1) + p(p(i)) - p(i-1); else a(i) = a(i-1) - p(p(i)) - p(i-1); end end % plot data figure scatter(1:length(a),a,'.') title('A328225 '); ylabel('A328225(n)'); xlabel('n') % write b-file number = 1:10000; data = [number; a]; fid = fopen('b328225.txt','w'); fprintf(fid,'%d %d \n',data); fclose(fid);