OFFSET
1,1
COMMENTS
The sequence contains many squares of primes.
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
Question 2: What is the sequence of composite numbers whose squares are in this sequence? It begins: 25, 289, 361, 529, ...
MAPLE
with(numtheory):
b:= proc(n) local h, i, k, m;
m, i:= 0, 0;
for k from 2 to floor(sqrt(n)) do
h:= nops(select(x-> irem(x, k)=0,
[seq (n-d, d=divisors(n-k) minus{1})]));
if h>m then m, i:= h, k fi
od; i
end:
a:= proc(n) option remember; local k;
for k from 1+ `if` (n=1, 3, a(n-1))
while not b(k)^2=k do od; k
end:
seq(a(n), n=1..15); # Alois P. Heinz, Apr 13 2011
MATHEMATICA
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];
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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Shevelev, Apr 12 2011
STATUS
approved