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.
%I A379749 #15 Jan 04 2025 22:30:19 %S A379749 5,7,13,41,31,43,113,73,181,331,397,157,547,211,241,1361,307,2053,761, %T A379749 421,463,1013,1657,601,1301,3511,757,2437,1741,1861,5953,2113,1123, %U A379749 2381,2521,6661,4219,1483,3121,13121,1723,3613,9461,9901,6211,12973,4513,7057,7351,2551,15913,8269,25759,2971 %N A379749 a(n) is the first prime that has digit sum n in base n and n+1 in base n+1. %C A379749 For n >= 3, the least number with digit sum n in base n and n+1 in base n+1 is A002061(n) = n^2 - n + 1. This is prime for n in A055494. Thus (if it exists) a(n) >= A002061(n), with equality for n in A055494. %H A379749 Robert Israel, <a href="/A379749/b379749.txt">Table of n, a(n) for n = 2..1000</a> %e A379749 For n = 8, a(8) = 113 because 113 is prime, 113 = 161_8 = 135_9 has digit sums 8 in base 8 and 9 in base 9, and no smaller prime works. %p A379749 f:= proc(n) local k,v,x; %p A379749 for k from 1 do %p A379749 v:= convert(convert(k,base,n),`+`); %p A379749 if v <= n then %p A379749 x:= k*n + n-v; %p A379749 if convert(convert(x,base,n+1),`+`) = n+1 and isprime(x) then return x fi %p A379749 fi %p A379749 od; %p A379749 end proc: %p A379749 map(f, [$2 .. 100]); %t A379749 a[n_]:=Module[{k=1}, While[DigitSum[Prime[k],n]!=n || DigitSum[Prime[k],n+1]!=n+1, k++]; Prime[k]]; Array[a,54,2] (* _Stefano Spezia_, Jan 01 2025 *) %o A379749 (PARI) a(n) = my(p=2); while ((sumdigits(p, n) != n) || (sumdigits(p, n+1) != n+1), p=nextprime(p+1)); p; \\ _Michel Marcus_, Jan 02 2025 %o A379749 (Python) %o A379749 from sympy import isprime %o A379749 from sympy.ntheory import digits %o A379749 def nextsod(n, base): %o A379749 c, b, w = 0, base, 0 %o A379749 while True: %o A379749 d = n%b %o A379749 if d+1 < b and c: %o A379749 return (n+1)*b**w + ((c-1)%(b-1)+1)*b**((c-1)//(b-1))-1 %o A379749 c += d; n //= b; w += 1 %o A379749 def A226636gen(sod=3, base=3): # generator of terms for any sod, base %o A379749 an = (sod%(base-1)+1)*base**(sod//(base-1))-1 %o A379749 while True: yield an; an = nextsod(an, base) %o A379749 def a(n): %o A379749 for k in A226636gen(sod=n, base=n): %o A379749 if sum(digits(k, n+1)[1:]) == n+1 and isprime(k): %o A379749 return k %o A379749 print([a(n) for n in range(2, 56)]) # _Michael S. Branicky_, Jan 04 2025 %Y A379749 Cf. A002061, A055494, A379743. %K A379749 nonn,base,look %O A379749 2,1 %A A379749 _Robert Israel_, Jan 01 2025