A225135 Squares that are a concatenation of primes.
25, 225, 289, 361, 529, 729, 2025, 2401, 2601, 2809, 3025, 4761, 5041, 5329, 5929, 7225, 7569, 11025, 11449, 11881, 13225, 15129, 19881, 20449, 21609, 22801, 23409, 24649, 25281, 26569, 27225, 29241, 29929, 31329, 32041, 32761, 34969, 36481, 39601, 47089
Offset: 1
Examples
25 = 5^2 and can be separated into two prime numbers: 2|5. 231361 = 481^2 and can be separated into prime numbers in six ways: 2|3|1361, 2|3|13|61, 2|31|3|61, 2|313|61, 23|1361, and 23|13|61. Leading zeros are allowed: 2025 = 2|02|5.
Links
- Christian N. K. Anderson, Table of n, a(n) for n = 1..10000
- Christian N. K. Anderson, Table of n, a(n), sqrt(a(n)), all possible separations of a(n) into primes for n = 1...10000
Programs
-
Mathematica
r[d_] := Catch@ Block[{z = Length@d}, z<1 || Do[ If[ PrimeQ@ FromDigits@ Take[d, i] && r@ Take[d, i-z], Throw@ True], {i, z}]]; Select[ Range[1000]^2, r@ IntegerDigits@ # &] (* Giovanni Resta, Apr 30 2013 *)
-
PARI
has(n)=if(isprime(n),return(1)); if(n<202,return(isprime(n%10) && isprime(n\10))); my(k=n%10,v);if(k==5||k==2,return(if(n<6,1,n\=10;has(n/10^valuation(n,10)))));if(k%2==0,return(0));v=digits(n);for(i=1,#v,if(isprime(n%10^i) && has(n\10^i), return(1))); 0 forstep(n=5,1e3,2,if(has(n^2),print1(n^2", "))) \\ Charles R Greathouse IV, Apr 30 2013
-
R
library(gmp); isprime2=function(x) isprime(x)>0 splithasproperty<-function(n,FUN,curdig=1,res=list(),curspl=c()) { no0<-function(s){ while(substr(s,1,1)=="0" & nchar(s)>1) s=substr(s,2,nchar(s)); s} s=as.character(n) if(curdig>nchar(s)) return(res) if(length(curspl)>0) if(FUN(as.bigz(no0(substr(s,curdig,nchar(s)))))) res[[length(res)+1]]=curspl for(i in curdig:nchar(s)) if(FUN(as.bigz(no0(substr(s,curdig,i))))) res=splithasproperty(n,FUN,i+1,res,c(curspl,i)) res } which(sapply(1:100,function(x) length(splithasproperty(x^2,isprime2)))>0)^2
Comments