login
Smallest number greater than 1 which ends in an odd digit in bases 2 through n.
0

%I #12 Jul 30 2023 17:35:28

%S 3,7,7,13,13,31,31,43,43,73,73,271,271,271,271,313,313,313,313,313,

%T 313,421,421,421,421,1303,1303,1303,1303,1303,1303,23563,23563,35803,

%U 35803,187003,187003,187003,187003,936703,936703,1426003,1426003,1426003,1426003

%N Smallest number greater than 1 which ends in an odd digit in bases 2 through n.

%e 13 = 1101 in base 2, 231 in base 3, 31 in base 4, 23 in base 5, 21 in base 6 but 16 in base 7, so 13 ends in an odd digit from bases 2 to 6.

%p a:= proc(n) option remember; local k; for k by 2 from `if`(n=2, 3,

%p a(n-1)) while ormap(b-> irem(k, b)::even, [$2..n]) do od; k

%p end:

%p seq(a(n), n=2..52); # _Alois P. Heinz_, Jul 30 2023

%t a[n_] := Module[{k = 3}, While[!AllTrue[Range[2, n], OddQ[Mod[k, #]] &], k += 2]; k]; Array[a, 45, 2] (* _Amiram Eldar_, Jul 30 2023 *)

%K base,nonn

%O 2,1

%A Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 23 2001

%E Data corrected by _Sean A. Irvine_, Jul 30 2023