pf 19 has at least 1 solution # 1 ,^:(0 = 1&p:@:(10&#.)@])(^:100) 1 1 1
19 1 p: 1111111111111111111x 1 On Saturday, September 23, 2023 at 01:18:44 p.m. EDT, 'Pascal Jasmin' via Programming <programm...@jsoftware.com> wrote: there is a bug in your p 3... 793 is not prime. An approach that can be improved upon in speed: perm =: i.@! A. i. raveltillCS =: 1 : ',/^:(m < #@$)^:_' NB. repeat ravel until count of shape = m p2 =: 1 3 7 9 ~.@:(,/^:(2 < #@$)^:_@:(/:~"1@:({ )~&:>)) (<0 1 2 3) { @:#~ ] NB. unique combinations(?) of digits (y is # of digits) that can form primes pf =: (perm (] #~ *./@:(1&p:)@:(10&#.)@:~.@:{"_ 1) p2) NB. filtered for all permutations of combinations being prime. pf 3 1 1 3 1 9 9 3 3 7 pf 4 5 6 7 8 9 has no results pf 10 takes a long time. also no results. On Saturday, September 23, 2023 at 01:54:28 a.m. EDT, 'Skip Cave' via Programming <programm...@jsoftware.com> wrote: Here's a verb p(n) to produce all n-digit primes with the same digits: odo=:#: i.@(*/) p=:{{(#~1&p:)10#.(odo y#4){1 3 7 9}} try it: p 2 11 13 17 19 31 37 71 73 79 97 p 3 113 131 137 139 173 179 191 193 197 199 311 313 317 331 337 373 379 397 719 733 739 773 797 911 919 937 971 977 991 997 p 4 1117 1171 1193 1319 1373 1399 1733 1777 1913 1931 1933 1973 1979 1993 1997 1999 3119 3137 3191 3313 3319 3331 3371 3373 3391 3719 3733 3739 3779 3793 3797 3911 3917 3919 3931 7177 7193 7331 7333 7393 7717 7793 7919 7933 7937 7993 9133 9137 9173 9199 9311 9319 9337 9371 9377 9391 9397 9719 9733 9739 9791 9931 9973 p 5 11113 11117 11119 11131 11171 11173 11177 11197 11311 11317 11393 11399 11717 11719 11731 11777 11779 11933 11939 11971 13171 13177 13313 13331 13337 13339 13397 13399 13711 13799 13913 13931 13933 13997 13999 17117 17137 17191 17317 17333 17377 17393 17713 17737 17791 17911 17939 17971 17977 19139 19319 19333 19373 19379 19391 19717 19739 19777 19793 19913 19919 19937 19973 19979 19991 19993 19997 31139 31177 31193 31319 31333 31337 31379 31391 31393 31397 31771 31793 31799 31973 31991 33113 33119 33179 33191 33199 33311 33317 33331 33377 33391 33713 33739 33773 33791 33797 33911 33931 33937 33997 37117 37139 37171 37199 37313 37337 37339 37379 37397 37717 37799 37991 37993 37997 39113 39119 39133 39139 39191 39199 39313 39317 39371 39373 39397 39719 39733 39779 39791 39799 39937 39971 39979 71119 71171 71191 71317 71333 71339 71399 71711 71713 71719 71777 71917 71933 71971 71993 71999 73133 73331 73379 73771 73939 73973 73999 77137 77171 77191 77317 77339 77377 77711 77713 77719 77731 77773 77797 77933 77977 77999 79111 79133 79139 79193 79319 79333 79337 79379 79393 79397 79399 79777 79939 79973 79979 79997 79999 91139 91193 91199 91331 91373 91393 91397 91711 91733 91771 91939 91997 93113 93131 93133 93139 93179 93199 93319 93337 93371 93377 93719 93739 93911 93913 93937 93971 93979 93997 97117 97171 97177 97373 97379 97397 97711 97771 97777 97919 97931 97973 99119 99131 99133 99137 99139 99173 99191 99317 99371 99377 99391 99397 99713 99719 99733 99793 99971 99991 Skip Cave Cave Consulting LLC On Sat, Sep 23, 2023 at 12:26 AM Richard Donovan <rsdono...@hotmail.com> wrote: > Hi > > I am trying to develop a program to find primes with n digits abc such > that acb bac bca cab and cba are also primes. (obviously trivial if aaa is > prime!). > > An example with n=3 is > > 1 p: 199 919 991 > > 1 1 1 > > These primes are thin on the ground since they cannot contain any of the > digits 2 4 5 6 8 or 0 and I am wondering if it would be best to construct > numbers omitting those containing those prohibited digits, or test every > comination of p: i. n which seems wasteful, especially since I want to find > all such primes below one million. > > Can anyone see an efficent way to produce this? > > Thanks in advance, > > Richard > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm