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.

A291654 Number of distinct values in the prime tree starting with n.

This page as a plain text file.
%I A291654 #18 Jul 30 2020 07:17:46
%S A291654 35,35,34,22,12,11,5,7,10,5,10,10,6,6,7,7,4,3,5,13,14,6,1,5,5,3,4,3,2,
%T A291654 2,4,3,2,2,3,3,1,4,6,3,3,3,1,3,7,6,2,2,2,6,6,1,6,9,5,5,5,2,4,5,2,2,2,
%U A291654 7,8,7,6,2,3,4,5,3,1,1,4,5,4,4
%N A291654 Number of distinct values in the prime tree starting with n.
%C A291654 Starting from n construct a tree that includes nodes for each prime in n^2 + n + 1, n^2 + n - 1, n^2 - n + 1, n^2 - n - 1, and recurse on each node until no further primes can be included.
%H A291654 Robert Israel, <a href="/A291654/b291654.txt">Table of n, a(n) for n = 1..10000</a>
%H A291654 Ralf Steiner, <a href="https://listserv.nodak.edu/cgi-bin/wa.exe?A2=NMBRTHRY;d5ff2a3a.1708">Prime-trees</a>, NMBRTHRY posting, 13 Aug 2017.
%e A291654 a(5) = 12 since the tree for 5 looks like this where, for example, the symbol -[+-]->  stands for p^2+p-1 and the symbol -| stands for a leaf:
%e A291654 5-[--]->19-[+-]->379-[--]->143261-|
%e A291654 -[-+]->143263-[-+]->20524143907-|
%e A291654 -[+-]->29-[--]->811-|
%e A291654 -[++]->31-[--]->929-|
%e A291654 -[+-]->991-[-+]->981091-|
%p A291654 f:= proc(n) local  R, agenda;
%p A291654   agenda:= {n}; R:= {n};
%p A291654   while nops(agenda) > 0 do
%p A291654     agenda:= select(isprime, map(t -> (t^2+t+1,t^2+t-1,t^2-t+1,t^2-t-1), agenda) minus R) ;
%p A291654     R:= R union agenda;
%p A291654   od;
%p A291654   nops(R);
%p A291654 end proc:
%p A291654 map(f, [$1..100]); # _Robert Israel_, Aug 29 2017
%t A291654 f[n_] := Module[{R = {n}, agenda = {n}}, While[Length[agenda] > 0, agenda = Select[Flatten[Map[Function[t, {t^2 + t + 1, t^2 + t - 1, t^2 - t + 1, t^2 - t - 1}], agenda]] ~Complement~ R, PrimeQ]; R = Union[R, agenda]]; Length[R]];
%t A291654 Array[f, 100] (* _Jean-François Alcover_, Jul 30 2020, after _Robert Israel_ *)
%K A291654 nonn
%O A291654 1,1
%A A291654 _Ralf Steiner_ and _Sean A. Irvine_, Aug 28 2017