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.

A338846 No nonprime digit is present in a(n) + a(n+1).

This page as a plain text file.
%I A338846 #19 Nov 20 2020 21:57:25
%S A338846 0,2,1,4,3,19,6,16,7,15,8,14,9,13,10,12,11,21,31,22,5,17,18,34,23,29,
%T A338846 24,28,25,27,26,46,176,47,30,42,33,20,32,40,35,37,36,39,38,184,41,181,
%U A338846 44,178,45,177,48,174,49,173,50,172,51,171,52,170,53,169,54,168,55,167,56,166,57,165,58,164,59
%N A338846 No nonprime digit is present in a(n) + a(n+1).
%C A338846 The nonprime digits are 0, 1, 4, 6, 8 and 9. This is the lexicographically earliest sequence of distinct nonnegative terms with this property and also a permutation of the nonnegative integers.
%H A338846 Robert Israel, <a href="/A338846/b338846.txt">Table of n, a(n) for n = 1..10000</a>
%H A338846 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the nonnegative integers</a>
%e A338846 a(1) + a(2) = 0 + 2 = 2 (no nonprime digit is present);
%e A338846 a(2) + a(3) = 2 + 1 = 3 (no nonprime digit is present);
%e A338846 a(3) + a(4) = 1 + 4 = 5 (no nonprime digit is present);
%e A338846 a(4) + a(5) = 4 + 3 = 7 (no nonprime digit is present);
%e A338846 a(5) + a(6) = 3 + 19 = 22 (no nonprime digit is present); etc.
%p A338846 N:= 1000: # for terms before the first term > N
%p A338846 S:= [$1...N]:
%p A338846 V:=Vector(N):
%p A338846 for n from 2 to N do
%p A338846   for i from 1 to N+2-n do
%p A338846     s:= S[i];
%p A338846     if convert(convert(V[n-1]+s,base,10),set) subset {2,3,5,7} then
%p A338846       V[n]:= s;
%p A338846       S:= subsop(i=NULL,S);
%p A338846       break
%p A338846     fi;
%p A338846   od;
%p A338846   if V[n] = 0 then break fi
%p A338846 od:
%p A338846 convert(V[1..n-1],list); # _Robert Israel_, Nov 18 2020
%t A338846 Block[{a = {0}}, Do[Block[{k = 1}, While[Nand[FreeQ[a, k], NoneTrue[IntegerDigits@ Total[a[[-1]] + k], ! PrimeQ@ # &]], k++]; AppendTo[a, k]], {i, 2, 75}]; a] (* _Michael De Vlieger_, Nov 12 2020 *)
%Y A338846 Cf. A338839, A338840, A338841, A338842, A338843, A338844, A338845 (variants on the same idea).
%K A338846 base,nonn,look
%O A338846 1,2
%A A338846 _Eric Angelini_ and _Carole Dubois_, Nov 11 2020