login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A379143
Lexicographically earliest sequence of distinct positive integers such that both the sum of terms a(1)..a(n) and the sum of the digits in these terms is a prime number.
1
2, 3, 6, 8, 4, 24, 20, 42, 22, 48, 44, 28, 26, 40, 114, 68, 64, 176, 82, 66, 80, 46, 84, 192, 110, 60, 138, 156, 118, 62, 136, 174, 134, 154, 200, 172, 158, 130, 132, 194, 222, 178, 86, 88, 150, 116, 246, 190, 228, 206, 244, 152, 204, 112, 264, 170, 196, 288, 866, 240, 208, 248, 312, 268, 242, 198, 282, 286, 266, 354, 220, 284, 262, 224, 280, 260, 330, 226
OFFSET
1,1
COMMENTS
As the sum of terms beyond a(2) = 3 must be odd, a(2) is the only odd term. Is is unknown if all even numbers appear.
Similarly, the sum of digits of terms beyond a(2) must be odd, so a(2) is the only term with odd sum of digits. 10 is the first even number that does not appear. - Michael S. Branicky, Dec 18 2024
LINKS
EXAMPLE
a(5) = 4 as the sum of both the terms and digits from a(1)..a(5) is 23, which is a prime number, and 4 has not previously appeared.
a(6) = 24 as the sum of terms from a(1)..a(6) is 47 while the sum of digits of these terms is 29, and both 47 and 29 are prime numbers while 24 has not previously appeared.
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def sod(n): return sum(map(int, str(n)))
def agen(): # generator of terms
aset, s, ds, m = {2, 3}, 5, 5, 4
yield from [2, 3]
while True:
an = next(k for k in count(m, 2) if k not in aset and all(isprime(i) for i in [s+k, ds+sod(k)]))
s, ds = s+an, ds+sod(an)
aset.add(an)
yield an
while m in aset or sod(m)&1: m += 2
print(list(islice(agen(), 80))) # Michael S. Branicky, Dec 18 2024
CROSSREFS
KEYWORD
nonn,base,new
AUTHOR
Scott R. Shannon, Dec 16 2024
STATUS
approved