A084333 Erroneous version of A084331.
2, 3, 5, 11, 7, 17, 29, 13, 31, 23, 37, 59, 19, 43, 71, 41, 61, 97, 53, 79, 47, 89, 127, 67
Offset: 1
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.
a(4)=7 because the previous term is 4 and the differences |3-4|, |5-4| and |6-4| have already occurred. After 7 we get 3 as the difference 4 has not occurred earlier. 5 follows 14 as the difference 9 has not occurred earlier.
import Data.List (delete) a081145 n = a081145_list !! (n-1) a081145_list = 1 : f 1 [2..] [] where f x vs ws = g vs where g (y:ys) = if z `elem` ws then g ys else y : f y (delete y vs) (z:ws) where z = abs (x - y) -- Reinhard Zumkeller, Jul 02 2015
f[s_] := Block[{d = Abs[Rest@s - Most@s], k = 1}, While[ MemberQ[d, Abs[k - Last@s]] || MemberQ[s, k], k++ ]; Append[s, k]]; NestList[s, {1}, 70] (* Robert G. Wilson v, Jun 09 2006 *) f[s_] := Block[{k = 1, d = Abs[Most@s - Rest@s], l = Last@s}, While[MemberQ[s, k] || MemberQ[d, Abs[l - k]], k++ ]; Append[s, k]]; Nest[f, {1}, 70] (* Robert G. Wilson v, Jun 13 2006 *)
{SV_p1(n)=local(x,v=6,d=2,j,k); /* Slater-Velez permutation - the first kind (by F. Adorjan)*/ x=vector(n);x[1]=1;x[2]=2; for(i=3,n,j=3;k=1;while(k,if(k=bittest(v,j)||bittest(d,abs(j-x[i-1])),j++,v+=2^j;d+=2^abs(j-x[i-1]);x[i]=j))); return(x)} \\ Ferenc Adorjan, Apr 03 2007
A081145_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1]) for n in range(3, 10**2): i = s while True: m = abs(i-l) if not (i in b1 or m in b2): A081145_list.append(i) b1.add(i) b2.add(m) l = i while s in b1: b1.remove(s) s += 1 break i += 1 # Chai Wah Wu, Dec 15 2014
N:= 1000: # for terms before the first term > N A[1]:= 1: SF:= select(numtheory:-issqrfree, [$2..N]): DA:= {}: y:= 1: found:= true: for n from 2 while found do found:= false; for j from 1 to nops(SF) while not found do x:= SF[j]; if not member(abs(x-y),DA) then found:= true; A[n]:= x; DA:= DA union {abs(x-y)}; SF:= subsop(j=NULL, SF); y:= x; fi od od: convert(A,list); # Robert Israel, Feb 22 2024
a(3) does not equal 7 since 3+5+7 which is 15 is not a prime, but the next prime, 11, meets the criteria.
s = {3, 5}; k = 1; While[k < 31, p = s[[-2]] + s[[-1]]; q = 7; While[ !PrimeQ[p + q] || MemberQ[s, q] || MemberQ[s, p + q], q = NextPrime@ q]; AppendTo[s, q]; AppendTo[s, p + q]; k++]; s
Comments