login
Numbers n such that n, prime(n), prime(n)+n, prime(n)-n and prime(n)*n all lack the digit 4.
2

%I #9 Apr 13 2022 12:06:33

%S 1,2,3,5,6,8,10,22,23,26,27,28,29,31,39,57,58,62,66,112,120,122,125,

%T 126,129,130,131,135,137,139,152,153,178,182,183,192,196,210,211,212,

%U 213,216,220,221,222,250,280,285,286,287,291,293,295,299,300,303,305,306

%N Numbers n such that n, prime(n), prime(n)+n, prime(n)-n and prime(n)*n all lack the digit 4.

%C From the first 3000 primes, only 289 are such that n, p[n], p[n]+n, p[n]-n and p[n]*n all are 4-less.

%H Robert Israel, <a href="/A104424/b104424.txt">Table of n, a(n) for n = 1..10000</a>

%p fourless:= n -> not has(4,convert(n,base,10)):

%p p:= 1: R:= NULL: count:= 0:

%p for n from 1 while count < 100 do

%p p:= nextprime(p);

%p if andmap(fourless, [n, p, p+n, p-n, p*n]) then

%p count:= count+1; R:= R, n;

%p fi

%p od:

%p R; # _Robert Israel_, Apr 23 2020

%t id[x_]:=IntegerDigits[x];pr[i_]:=Prime[i];ra=Range[3000];A104424=Select[ra, Position[Union[id[ # ], id[pr[ # ]], id[pr[ # ]+# ], id[pr[ # ]-# ], id[pr[ # ]*# ]], 4]=={}&]

%t Select[Range[350],Count[Flatten[IntegerDigits/@{#,Prime[#],Prime[ #]+#,Prime[ #]-#,Prime[ #]#}],4]==0&] (* _Harvey P. Dale_, Apr 13 2022 *)

%Y Cf. A104419-A104428.

%K nonn,base

%O 1,2

%A _Zak Seidov_, Mar 07 2005

%E Name edited by _Robert Israel_, Apr 23 2020