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.

A117388 a(n) is the smallest n-digit integer such that, if all numbers formed by inserting the exponentiation symbol between any two digits are added up, the sum is prime.

This page as a plain text file.
%I A117388 #16 Jun 27 2022 11:25:45
%S A117388 21,121,1226,14423,111334,1186896
%N A117388 a(n) is the smallest n-digit integer such that, if all numbers formed by inserting the exponentiation symbol between any two digits are added up, the sum is prime.
%C A117388 No zeros are allowed in the decimal representation of a(n).
%e A117388 a(5) = 14423 since 1^4423+14^423+144^23+1442^3 is prime.
%t A117388 (* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Block[{k = (10^n - 1)/9}, While[id = IntegerDigits@k; First@ Union@ id == 0 || !PrimeQ[Plus @@ Table[FromDigits@ Take[id, {1, k}]^FromDigits@ Take[id, {k + 1, n}], {k, n - 1}]], k++ ]; k]; Do[Print[f[n]] // Timing, {n, 2, 7}] (* _Robert G. Wilson v_, Apr 27 2006 *)
%o A117388 (Python)
%o A117388 from sympy import isprime
%o A117388 from itertools import product
%o A117388 def a(n):
%o A117388     for p in product("123456789", repeat=n):
%o A117388         s = "".join(p)
%o A117388         if isprime(sum(int(s[:i])**int(s[i:]) for i in range(1, n))):
%o A117388             return int(s)
%o A117388 print([a(n) for n in range(2, 6)]) # _Michael S. Branicky_, Jun 27 2022
%Y A117388 Cf. A113762.
%K A117388 base,more,nonn
%O A117388 2,1
%A A117388 _Ray G. Opao_, Apr 25 2006
%E A117388 a(6) from _Robert G. Wilson v_ and _Farideh Firoozbakht_, Apr 27 2006
%E A117388 a(7) from _Sean A. Irvine_, Dec 15 2009