login
Smallest double square (cf. A001105) greater than n-th prime.
4

%I #10 Jan 24 2022 08:01:06

%S 2,8,8,8,18,18,18,32,32,32,32,50,50,50,50,72,72,72,72,72,98,98,98,98,

%T 98,128,128,128,128,128,128,162,162,162,162,162,162,200,200,200,200,

%U 200,200,200,200,200,242,242,242,242,242,242,242,288,288,288,288

%N Smallest double square (cf. A001105) greater than n-th prime.

%C For n > 2: prime(n) < a(n) < 2*prime(n) and a(n) = A245499(A000040(n),2).

%H Reinhard Zumkeller, <a href="/A245508/b245508.txt">Table of n, a(n) for n = 1..10000</a>

%t Module[{nn=60,ds},ds=2 Range[0,Ceiling[Sqrt[Prime[nn]]]]^2;Join[ {2},Table[ SelectFirst[ds,#>Prime[n]&],{n,2,nn}]]] (* _Harvey P. Dale_, Jan 07 2020 *)

%o (Haskell)

%o import Data.List (genericIndex)

%o a245508 n = genericIndex a245508_list (n-1)

%o a245508_list = f a000040_list a001105_list where

%o f ps'@ (p:ps) xs'@(x:xs) = if p <= x then x : f ps xs' else f ps' xs

%o (PARI) a(n) = my(k=prime(n)+(n!=1)); while (! issquare(k/2), k+=2); k; \\ _Michel Marcus_, Jan 24 2022

%Y Cf. A000040, A001105, A145445.

%K nonn

%O 1,1

%A _Reinhard Zumkeller_, Jul 25 2014