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.

A181642 Minimal sequence whose forwards van Eck transform is the sequence of prime numbers.

This page as a plain text file.
%I A181642 #28 Jun 15 2019 21:40:39
%S A181642 0,1,0,2,1,3,4,0,5,6,2,7,8,9,10,1,11,12,3,13,14,15,16,4,17,18,0,19,20,
%T A181642 21,22,5,23,24,25,26,27,28,6,29,30,2,31,32,33,34,35,36,7,37,38,39,40,
%U A181642 8,41,42,9,43,44,45,46,10,47,48,49,50,51,52,1,53,54
%N A181642 Minimal sequence whose forwards van Eck transform is the sequence of prime numbers.
%C A181642 At each step, the minimum available integer is used.
%C A181642 From _Rémy Sigrist_, Aug 12 2017: (Start)
%C A181642 a(n)=0 iff n belongs to A074271.
%C A181642 a(n)=1 iff n > 1 and n belongs to A259408.
%C A181642 For any k > 0, A064427(k) = least n such that a(n) = k-1.
%C A181642 (End)
%H A181642 Rémy Sigrist, <a href="/A181642/b181642.txt">Table of n, a(n) for n = 1..10000</a>
%e A181642 a(1)=0. Next 0 is at distance 2 (1st prime): a(3)=0.
%e A181642 a(2)=1. Next 1 is at distance 3 (2nd prime): a(5)=1.
%e A181642 a(3)=0. Next 0 is at distance 5 (3rd prime): a(8)=0.
%e A181642 For a(4), we can use neither 0 (distance 1 from previous 0 would lead to an incongruence) nor 1 (distance 1 from subsequent 1 would lead to another incongruence). Therefore we must use 2.
%e A181642 Next 2 must be at distance 7 (4th prime): a(11)=2. And so on.
%p A181642 P:=proc(q,h) local i,k,n,t,x; x:=array(1..h); for k from 1 to h do x[k]:=-1; od; x[1]:=0; i:=0; t:=0;for n from 1 to q do if isprime(n) then  i:=i+1; if x[i]>-1 then x[i+n]:=x[i]; else t:=t+1; x[i]:=t; x[i+n]:=x[i]; fi; fi; od; seq(x[k],k=1..79); end: P(400,500);
%o A181642 (PARI) a = vector(71, i, -1); u = 0; for (n=1, #a, if (a[n]<0, o = n; while (o <= #a, a[o] = u; o += prime(o)); u++); print1 (a[n] ", ")) \\ _Rémy Sigrist_, Aug 12 2017
%Y A181642 Cf. A000040, A064427, A074271, A181391, A259408.
%K A181642 easy,nonn
%O A181642 1,4
%A A181642 _Paolo P. Lava_ & _Giorgio Balzarotti_, Nov 03 2010
%E A181642 More terms from _Rémy Sigrist_, Aug 12 2017