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.

A213018 Largest possible right-truncatable base n semiprime, written in decimal notation.

This page as a plain text file.
%I A213018 #18 Aug 05 2022 07:46:03
%S A213018 349859,96614184696363331,21453921664462866568480385,
%T A213018 5396625577204731352098054139,1230847457959658263441326143300761,
%U A213018 95861957783594714393831931415189937897,246968512564969427282294385793684699270364003,2275670244821939317343219562642735197101789412250091,452359410421075824795509870868069265597540337861667320077
%N A213018 Largest possible right-truncatable base n semiprime, written in decimal notation.
%C A213018 For the definition of a right-truncatable semiprime, see A213017. The process of truncating at the right end of the digit string has to be applied to the base-n representation given in the examples. a(10) was found by S.S. Gupta. All other terms have been computed by Hermann Jurksch.
%e A213018 a(5)=349859=42143414 in base 5 = 89*3931
%e A213018 4214341 in base 5 = 69971 = 11*6361
%e A213018 421434 in base 5 = 13994 = 2*6997
%e A213018 42143 in base 5 = 2798 = 2*1399
%e A213018 4214 in base 5 = 559 = 13*43
%e A213018 421 in base 5 = 111 = 3*37
%e A213018 42 in base 5 = 22 = 2*11
%e A213018 4 in base 5 = 4 = 2*2
%e A213018 a(6)=4223145115415551545111 in base 6
%e A213018 a(7)=644324264233631242462662622646 in base 7
%e A213018 a(8)=4267773725372537135533515117773 in base 8
%e A213018 a(9)=43741424882428682844851886888222774 in base 9
%e A213018 a(10)=95861957783594714393831931415189937897 in base 10
%e A213018 a(11)=4567476a2738a828994aa851a116aa886a95686a231 in base 11
%e A213018 a(12)=43a2971ba155719171a2b1b97777775b779a732b755572b7 in base 12
%e A213018 a(13)=9114448462c6c46b3c9937446466b43686a24668666732c4356 in base 13
%o A213018 (Python)
%o A213018 from sympy import factorint
%o A213018 def fromdigits(t, b): return sum(b**i*di for i, di in enumerate(t[::-1]))
%o A213018 def semiprime(n): return sum(factorint(n).values()) == 2
%o A213018 def a(n):
%o A213018     m, s = 0, [(i,) for i in range(n) if semiprime(fromdigits((i,), n))]
%o A213018     while len(s) > 0:
%o A213018         m = fromdigits(max(s), n)
%o A213018         cands = set(t+(d,) for t in s for d in tuple(range(n)))
%o A213018         s = [c for c in cands if semiprime(fromdigits(c, n))]
%o A213018     return m
%o A213018 print([a(n) for n in range(5, 8)]) # _Michael S. Branicky_, Aug 04 2022
%Y A213018 Cf. A001358, A085733, A213017.
%K A213018 nonn,base,hard
%O A213018 5,1
%A A213018 _Hugo Pfoertner_, Jun 26 2012