%I #25 Feb 04 2024 18:25:29
%S 0,1,2,3,5,7,4,11,13,6,10,17,19,14,8,22,23,29,26,9,15,34,31,37,38,21,
%T 12,33,46,41,43,58,39,18,20,51,62,47,53,74,57,28,16,44,69,82,59,61,86,
%U 87,52,24,25,68,93,94,67,71,106,111,76,35,30,55,92,123,118
%N Triangle of hexagons read by row, with right diagonal having in-order odd-indexed primes, left diagonal having 2 followed by the in-order even-indexed primes, and column elements are the least multiple of the prime at the top of the column not already in the sequence, with 0 and 1 prepended.
%C The sequence is a permutation of the nonnegative integers.
%e a(0)=0, a(1)=1, followed by triangle read by rows:
%e |2|
%e |3| | | |5 |
%e |7 | | | |4| | | |11|
%e |13| | | |6| | | |10| | | |17|
%e |19| | | |14| | | |8| | | |22| | | |23|
%e Row 5, element 3 = 8, because 2*3=6 has already appeared, but 2*4=8 has not.
%o (Python)
%o from sympy.ntheory.generate import prime
%o from math import ceil
%o def get_column_tops(n):
%o return [1 + abs((n-1)-2*m) for m in range(1,n-1)]
%o def get_indices(rowNum):
%o left=(rowNum*(rowNum-1))//2
%o right=left+rowNum-1
%o return (left, right)
%o def get_least(m,seq):
%o mult=2
%o d=m*mult
%o while d in seq:
%o mult+=1
%o d=m*mult
%o return d
%o seq,rnum = ([],1)
%o while len(seq)<56:
%o seq.append(prime(rnum+max(0,rnum-2)))
%o cols = get_column_tops(rnum)
%o for k in range(len(cols)):
%o ndcs=get_indices(cols[k])
%o if k<ceil(len(cols)/2):
%o m=seq[ndcs[0]]
%o seq.append(get_least(m,seq))
%o else:
%o m=seq[ndcs[1]]
%o seq.append(get_least(m,seq))
%o if rnum > 1:
%o seq.append(prime(2*rnum-1))
%o rnum+=1
%o seq=[0,1]+seq
%o print(seq)
%Y Cf. A143182.
%K nonn,tabl
%O 0,3
%A _J. Stauduhar_, Jan 25 2024
|