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.

A290175 Smallest prime p such that A290174(i) = n, where i is the index of p in A000040.

This page as a plain text file.
%I A290175 #14 Jul 26 2017 09:13:57
%S A290175 2,11,41,19,71,367,587,131,1151,1987,4253,8831,11839,117497,12269,
%T A290175 28279,297793,167711,1748653,1427297,7655719,13992553,4594229,
%U A290175 12932441,54321763,32833217,112155839,231132271,211119257,1154494127,137764883
%N A290175 Smallest prime p such that A290174(i) = n, where i is the index of p in A000040.
%t A290175 f[n_] := Block[{p = Prime@ n, k = 0, w}, w = {p}; While[w != {}, w = Flatten@ Map[Block[{m = #, L = {}, q = 10, a, b, v}, While[q <= m, a = Floor[m/q]; b = Mod[m, q]; v = 10 q a + b; If[b >= q/10 && PrimeQ[v], AppendTo[L, v]]; q *= 10]; L] &, w]; k++]; k - 1]; With[{s = Array[f, 10^5]}, Map[If[# == 0, 0, Prime@ #] &@ First[FirstPosition[s, #] /. k_ /; MissingQ@ k -> {0}] &, Range[0, Max@ s]]] (* _Michael De Vlieger_, Jul 24 2017, after _Giovanni Resta_ at A290174 *)
%o A290175 (PARI) insertzero(num, pos) = 10*(num-num%10^pos)+(num%10^pos)
%o A290175 zeroprimevec_num(n) = my(w=[]); for(k=1, #Str(n)-1, my(x=insertzero(n, k)); if(ispseudoprime(x), w=concat(w, [x]))); vecsort(w, , 8)
%o A290175 zeroprimevec_vec(v) = my(w=[]); for(k=1, #v, w=concat(w, zeroprimevec_num(v[k]))); vecsort(w, , 8)
%o A290175 a290174(n) = my(i=0, p=prime(n), v=zeroprimevec_num(p)); while(1, if(#v==0, return(i), i++); v=zeroprimevec_vec(v))
%o A290175 a(n) = my(x=1); while(1, if(a290174(x)==n, return(prime(x)), x++))
%o A290175 (PARI) first(n) = {n--; my(v = vector(n), todo = n, x=1); while(todo>0,
%o A290175 r = a290174(x); if(0<r&&r<=n, if(v[r]==0, v[r]=prime(x); todo--)); x++); concat([2], v)} \\ This prog uses the prog 'a290174' above. _David A. Corneth_, Jul 24 2017
%Y A290175 Cf. A000040, A290174.
%K A290175 nonn,more
%O A290175 0,1
%A A290175 _Felix Fröhlich_, Jul 24 2017
%E A290175 a(20)-a(30) from _Giovanni Resta_, Jul 24 2017