Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #30 Nov 11 2020 08:18:14
%S 4,9,25,49,121,169,289,361,625,841,961,1369,1681,1849,3721,4489,5041,
%T 5329,7921,9409,10201,10609,11881,12769,16129,17161,18769,19321,22201,
%U 22801,24649,32761,36481,37249,38809,39601,44521,52441,57121,58081,63001,73441
%N Numbers n for which A188794(n)^2 = n.
%C The sequence contains many squares of primes.
%C Question 1: What is the sequence of primes whose squares are not in this sequence? It begins: 23, 47, 53, 59, 79, 83, 107, ... A188833
%C Question 2: What is the sequence of composite numbers whose squares are in this sequence? It begins: 25, 289, 361, 529, ...
%p with(numtheory):
%p b:= proc(n) local h, i, k, m;
%p m, i:= 0, 0;
%p for k from 2 to floor(sqrt(n)) do
%p h:= nops(select(x-> irem(x, k)=0,
%p [seq (n-d, d=divisors(n-k) minus{1})]));
%p if h>m then m, i:= h, k fi
%p od; i
%p end:
%p a:= proc(n) option remember; local k;
%p for k from 1+ `if` (n=1, 3, a(n-1))
%p while not b(k)^2=k do od; k
%p end:
%p seq(a(n), n=1..15); # _Alois P. Heinz_, Apr 13 2011
%t b[n_] := Module[{h, i = 0, k, m = 0}, For[k = 2, k <= Floor[Sqrt[n]], k++, h = Length[Select[Table[n - d, {d, Rest[Divisors[n - k]]}], Mod[#, k] == 0 &]]; If[h > m, {m, i} = {h, k}]]; i];
%t Reap[For[n = 1, n <= 80000, n++, If[b[n]^2==n, Print[n]; Sow[n]]]][[2, 1]] (* _Jean-François Alcover_, Nov 11 2020, after _Alois P. Heinz_ *)
%Y Cf. A188550, A188579, A188794, A188833.
%K nonn
%O 1,1
%A _Vladimir Shevelev_, Apr 12 2011