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.

A340064 Every odd term k of the sequence is the cumulative sum of the prime digits used so far (the digits of k are included in the sum).

This page as a plain text file.
%I A340064 #12 Jan 01 2021 12:16:59
%S A340064 3,2,4,6,8,10,12,14,16,18,20,9,22,24,26,28,19,21,30,32,34,36,38,40,42,
%T A340064 43,44,46,48,50,52,54,63,73,56,58,60,62,64,66,68,70,72,101,74,76,78,
%U A340064 80,82,84,86,88,90,92,94,96,98,100,102,131,104,106,108,110,112,114,116,118,120,122,124,141,126,128,153
%N A340064 Every odd term k of the sequence is the cumulative sum of the prime digits used so far (the digits of k are included in the sum).
%C A340064 This is the lexicographically earliest sequence of distinct positive terms with this property. The prime digits are 2, 3, 5 and 7.
%C A340064 The sequence is first extended with the smallest odd term not leading to a contradiction; if no such term exists, the sequence is extended with the smallest even term not yet present.
%e A340064 Not a(1) = 1 as this 1, being odd, should be the sum of the prime digits so far -- which is wrong (there are none);
%e A340064 not a(1) = 2 as a(1) = 3 is odd and possible here;
%e A340064 a(12) = 9 as 9 is odd and the sum of the prime digits 3 + 2 + 2 + 2;
%e A340064 a(13) = 22 as 22 is the smallest even term available;
%e A340064 a(17) = 19 as 19 = 3 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2;
%e A340064 a(18) = 21 as 21 is the sum of 19 + 2 (the first digit of 21 itself); etc.
%o A340064 (Python)
%o A340064 def pds(k): return sum(int(d) for d in str(k) if d in "2357")
%o A340064 def aupto(nn):
%o A340064   aset, alst, primesum, nexteven = set(), [], 0, 2
%o A340064   for n in range(1, nn):
%o A340064     k = 1
%o A340064     found = False
%o A340064     while not found:
%o A340064       while k in aset: k += 2
%o A340064       if k == primesum + pds(k): found = True; break
%o A340064       if k > primesum + 7 * len(str(k)): break
%o A340064       k += 2
%o A340064     if found: ak = k
%o A340064     else: ak = nexteven; nexteven += 2
%o A340064     aset.add(ak); alst.append(ak); primesum += pds(ak)
%o A340064   return alst
%o A340064 print(aupto(76)) # _Michael S. Branicky_, Dec 29 2020
%Y A340064 CF. A338924
%K A340064 base,nonn
%O A340064 1,1
%A A340064 _Eric Angelini_ and _Carole Dubois_, Dec 28 2020