cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A358154 a(n) is the smallest composite number obtained by appending one or more 1's to n.

This page as a plain text file.
%I A358154 #21 Dec 22 2022 14:40:21
%S A358154 111,21,3111,411,51,611,711,81,91,1011,111,121,1311,141,15111,161,171,
%T A358154 18111,1911,201,21111,221,231,24111,2511,261,27111,2811,291,301,3111,
%U A358154 321,3311,341,351,361,371,381,391,4011,411,42111,4311,441,451,4611,471,481,4911,501,511,5211,531,5411
%N A358154 a(n) is the smallest composite number obtained by appending one or more 1's to n.
%C A358154 a(n) is either 10*n+1, 100*n+11 or 1000*n+111, because at least one of these is divisible by 3. - _Robert Israel_, Nov 01 2022
%C A358154 Actually: exactly one of these is divisible by 3. Almost all terms are a(n) = 10n + 1: this is the case for about (k-1)/k of the terms up to 10^k (i.e., 69% ~ 2/3 up to 10^3, 76% = 3/4 up to 10^4, 80% = 4/5 up to 10^5, 83% = 5/6 up to 10^6). - _M. F. Hasler_, Nov 03 2022
%p A358154 f:= proc(n) local x;
%p A358154    x:= n;
%p A358154    do
%p A358154      x:= 10*x+1;
%p A358154      if not isprime(x) then return x fi;
%p A358154    od
%p A358154 end proc:
%p A358154 map(f, [$1..100]); # _Robert Israel_, Nov 01 2022
%t A358154 a[n_] := NestWhile[10*# + 1 &, 10*n + 1, ! CompositeQ[#] &]; Array[a, 54] (* _Amiram Eldar_, Nov 01 2022 *)
%o A358154 (Python)
%o A358154 from sympy import isprime
%o A358154 def A358154(n):
%o A358154     t = str(n)+'1'
%o A358154     while isprime(int(t)):t=t+'1'
%o A358154     return int(t)
%o A358154 print([A358154(i) for i in range(1, 100)])
%o A358154 (PARI) a(n) = my(d=digits(n), m); if (!isprime(n), d = concat(d, 1)); while(isprime(m=fromdigits(d)), d=concat(d, 1)); m; \\ _Michel Marcus_, Nov 01 2022
%Y A358154 Cf. A069568, A112386, A002808, A153275.
%K A358154 nonn,base
%O A358154 1,1
%A A358154 _Gleb Ivanov_, Nov 01 2022